Dynamic Actions - Multiple Scenarios
Dynamic Actions - Multiple Scenarios
Dynamic Actions - Multiple Scenarios
.
Figure 2: Maintain Table V_T588Z through transaction SM30.
Infotype Number (INFTY): specifies the infotype for which you want the dynamic
action triggered
Field Name (FIELDN): starts your action when a maintenance function is performed
on a particular field
Function (FC): specifies the various maintenance operations to which your dynamic
action would respond. They are 02 (change); 04 (create); 06 (create and change); 08
(delete); 10 (change and delete); 12 (create and delete). Dynamic actions are only
applicable in maintenance operations, not in display functions.
Step (A): specifies a particular type of action. No dynamic action is executed if the
function character has a value other than one of the following:
P: Plausibility checks, which allow you to check certain conditions.
I: Calls an infotype for processing
W: Called after the I statement and used to assign values to screen fields while
creating or copying another infotype record through the I statement
V: Lets you treat collectively a number of fields for which you want to define a
common dynamic action
F: Calls a FORM routine (subroutines in ABAP) during your action. The
routine may reside in or out the module pool MPNNNN00
M: Sends SAP Office mail
Variable function part: The variable function part along with the step indicator
forms the core part of your action. It specifies the processing details when the
dynamic action is triggered.
****************************************************************************
Example 1:
Requirement: When there is a change in Basic pay infotype 0008 for country Ireland, an email
should be sent to the administrator.
For this requirement table V_T588Z is configured as follows.
****************************************************************************
Example 2:
Requirement: For country Austria (Country code =3), when the city ( Field ORT01) of an
employees permanent residence is changed in infotype 0006, an entry in Infotype 0367 and
subtype 6 should be modified with the same beginning date and End date as in Infotype 0006.
For this requirement table V_T588Z is configured as follows.
The lines 001-003 formulate the condition for the action (note the OR logic achieved by /X).
The insertion lines 004, 005, and 006 are executed only when the conditions mentioned are
true.
****************************************************************************
Example 4:
Requirement: On successful deletion of an infotype 0015 record having subtype 1234, all
records with subtype 1235 and 1236 should be deleted automatically.
For this requirement table V_T588Z is configured as follows.
The first two lines check that the record being deleted belongs to country grouping
international (code 99) and that the wage type is 1234. If this is found true, the two delete
statements are fired, each deleting all the records having wage type 1235 and 1236.
If you are puzzled about how many dynamic actions exist for a particular set of lines in table
T588Z, follow a simple rule: Each I, F, and M statement is a separate dynamic action.
In the following example, two dynamic actions are executed for the same combination of
SUBTYP,FIELD/FUNCTION. One action creates infotype 0041 if the reason is 01 and
another action creates infotype 8 if the reason is 02.
****************************************************************************
Example 5:
Requirement: Let's look at an example of an action. These statements check the country
grouping and the action type. If these match the desired criteria, a record is inserted in infotype
41 having date types U1 and U2.
For this requirement table V_T588Z is configured as follows.
When you create a new record (04) in infotype 0000, this dynamic action checks the following
conditions:
Is T001P-MOLGA equal to 99?
Is PSPAR-MASSN equal to 01?
If both conditions specified by the P statements are found to be true, then a new record is
created in infotype 41 in background mode. The values specified by the W statements are also
assigned to the corresponding screen fields of infotype 0041. If the condition defined by the P
statement is not filled, the system skips the subsequent commands until it reaches a new
plausibility check or F statement.
****************************************************************************
You may encounter problems assigning values to fields having the form QNNNNFIELDNAME. These are fields that are visible on the infotype screen Examples are
Q0082-datwc and Q0112-PZIN3. There lies a chance that these fields are overwritten
by values computed during the PBO and PAI modules of the infotype screen. For this
reason, assigning values to these fields in W statements may or may not have any
practical effect. However, you can use them in your P statements.
You may experience problems when your dynamic action calls an infotype that has its
own dynamic action written. When the second infotype is called and the user presses
the save button, the dynamic action of the second infotype runs. It may be a problem if
the second dynamic action calls a FORM routine that takes you to an undesirable
screen for the first one.
Dynamic actions are turned off during the execution of batch input sessions. This is a
standard behavior. Any updates that happen via dynamic actions in online mode must
be explicitly included in the BDC session.