Hi all,
Can anyone please explain how to write the VARIABLE FUNCTION in creating dynamic actions? Also please tell what do we enter in the FIELDN column.Here iam mentioning certain examples .In each one please explain in detail each parameter( e.g. P0001,INS,BEGDA,ENDDA etc.) in the variable function and how the variable function and fieldn columns have been arrived at.
Thanks in advance!
Awaiting reply eagerly.
regards,
meera.
Requirement: When the postal code or the city of an employee’s permanent residence is changed in infotype 0006, an email should be sent to the administrator.
INFTY SUBTY FIELDN FC NO. STEP VARIABLE FUNCTION
0006 1 ORT01 06 001 V PSTLZ
0006 1 PSTLZ 06 002 M M0001
The V statement on line 001 is used to link the two fields to the M statement. The statements relevant to field PSTLZ are also applicable to the ORT01 field.
When a record is created or changed in infotype 0006 of permanent address, an email is sent using the feature M0001. Information such as the recipient address, subject, and content of the mail is derived from M0001.
Requirement: You want to create two allowances (2001 and 2002) in infotype 0014 with the creation of Basic Pay - 0008 for employees belonging to Personnel Sub-area SUB1 and having either Grade 1 or Grade 2. The Allowance 2001 must be created in online mode, whereas the 2002 is in the background.
INFTY SUBTY FIELDN FC NO. STEP VARIABLE FUNCTION
0008 06 001 P P0001-BTRTL<>'SUB1'
0008 06 002 P P0008-TRFGR='GRADE 1' /X
0008 06 003 P P0008-TRFGR='GRADE 2' /X
0008 06 004 I INS,0014,2001,,(P0008-BEGDA),(P0008-ENDDA)
0008 06 005 I INS,0014,2001,,20020101,99991231/D
0008 06 006 W P0014-BETRG='1800'
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.
Requirement : On successful deletion of an infotype 0015 record having subtype ‘1234’, all records with subtype ‘1235’ and ‘1236’ should be deleted automatically.
INFTY SUBTY FIELDN FC NO. STEP VARIABLE FUNCTION
0015 08 001 P T500P-MOLGA='99'
0015 08 002 P P0015-LGART='1234'
0015 08 003 I DEL,15,1235 /D
0015 08 004 P T500P-MOLGA='99'
0015 08 005 P P0015-LGART='1234'
0015 08 006 I DEL,15,1236 /D
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.
0000 06 001 P PSPAR-MASSG=’01’
0000 06 002 I INS,0041,,,(P0000-BEGDA),(P0000-ENDDA)/D
0000 06 003 P PSPAR-MASSG=’02’
0000 06 004 I INS,0008,,,(P0000-BEGDA),(P0000-ENDDA)/D
EXAMPLE
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. 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 equals ‘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 fulfilled, the system skips the subsequent commands until it reaches a new plausibility check or F statement.
INFTY SUBTY FIELDN FC NO. STEP VARIABLE FUNCTION
0000 |
|
04 |
001 |
P |
T001P-MOLGA='99' |
0000 |
|
04 |
002 |
P
|
PSPAR-MASSN='01'
|
0000 |
|
04 |
003 |
I |
INS,0041,,,(P0000-BEGDA),(P0000-ENDDA)/D |
0000 |
|
04 |
004 |
W |
P0041-DAR01='U1' |
0000 |
|
04 |
005 |
W |
P0041-DAT01=P0000-BEGDA |
0000 |
|
04 |
006 |
W |
P0041-DAR02='U2' |
0000 |
|
04 |
007 |
W |
P0041-DAT02=P0000-BEGDA |