Q
Problem solve Get help with specific problems with your technologies, process and projects.

Setting a default value for an infotype during pa20/30 and pb20/30 transactions

Our expert describes in detail how to set the default value for an infotype during pa20/30 and pb20/30 transactions.

What is the best way to set a default value for an infotype so that it will take affect in the pa20/30 pb20/30...

transactions?

My preferred solution to default specific infotype fields for which SAP does not provide a standard feature is to create a custom feature that contains a decision tree based on enterprise structure or other data elements, and execute the custom feature from within one of the user exits called during maintain master data transactions.

The main advantage of this solution is that once this field default has been setup then any changes or additions to the default logic can be easily maintained by configuring the custom feature without any new ABAP coding.

Another advantage of this solution is that with the customer feature it is easier to build a large and complex decision tree that would be quite difficult, for example, to replicate through dynamic actions or even to hardcode in ABAP.

In order to accomplish this 2 main steps are needed:

>>> Create custom feature
>>> Insert code to call feature in user exit

As an example I will use the field "Additional indicator for time management" from Infotype 7 (p0007-kztim). Standard SAP does not have a default for this field.

===== Create custom feature =====
When creating a custom feature it is important to select a feature with the structure that corresponds with the data elements you want to use for decisions for the defaults. In this example custom feature ZZTIM was copied from standard feature FMLMO since this feature is able to use work schedule in the decision tree (uses structure pme93).

After copying the feature you can configure the decision tree as needed for the default logic.
Example decision tree in custom feature:
000010 D MOLGA
000020 ** &ZZTIM=,
000030 10 D SCHKZ
000040 10 * &ZZTIM=,
000050 10 ** &ZZTIM=,
000060 10 *** &ZZTIM=,
000070 10 **** &ZZTIM=,
000080 10 ***** &ZZTIM=,
000090 10 ****** &ZZTIM=,
000100 10 ******* &ZZTIM=,
000110 10 800-1600 &ZZTIM=AA,
000120 10 900-1700 &ZZTIM=BB,
 

Default for the field "Additional indicator for time management" is AA for work schedule 800-1600, BB for work schedule 900-1700 or blank in all other cases.

===== Insert code to call feature in user exit =====
Once the custom feature has been created and configure then one of the user exits called during Infotype maintenance has to call the custom feature.

User exits should be maintained with transaction CMOD. The specific exits are called from standard SAP programs LXPADTOP, LXPADU01 and LXPADU02.
The respective custom programs for clients to modify are called ZXPADTOP, ZXPADU01 and ZXPADU02 (if these programs do not exist then they need to be created first by an ABAP developer).

The difference between ZXPADU01 and ZXPADU02 is the timing when the user exit is called during Infotype maintenance. ZXPADU01 is called immediately before entering additional data on the screen (PBO – process before output) and ZXPADU02 is called after entering additional data and just before saving the screen (PAI – process after input).

In this case the default is called after input since the "new" work schedule is driving the default value. Below is some example code for data declaration and calling of the customer feature.

*----------------------------------------------------------------------*
* INCLUDE ZXPADTOP *
*----------------------------------------------------------------------*
 

* data declaration in ZXPADTOP "Global Data for ZXPADU01, ZXPADU02
DATA: I0007 LIKE P0007, "Gerard Broersma 03/29/2004
T549B_KZTIM like P0007-KZTIM,
T549BRC(2) type p.
 

* Tables "Gerard Broersma 05/20/2004
TABLES: pme93.

INCLUDE RPUMKC00.

*----------------------------------------------------------------------*
* INCLUDE ZXPADU02 *
*----------------------------------------------------------------------*

CASE INNNN-INFTY.

* IT0007 default Additional Time Mgmt ID (feature ZZTIM)

WHEN '0007'. "Gerard Broersma 03/29/2004"

MOVE INNNN TO I0007.

MOVE-CORRESPONDING I0007 TO PME93. "new code 05/20/2004
MOVE I001P-MOLGA TO PME93-MOLGA.

PERFORM re549d using 'ZZTIM' '3' T549B_KZTIM T549BRC.
MOVE T549B_ZZTIM TO I0007-KZTIM.

MOVE I0007 TO INNNN.

WHEN OTHERS.

ENDCASE.

This was last published in July 2006

Dig Deeper on SAP Basis administration and NetWeaver administration

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close