SAP HR – Understanding Dynamic Actions II
Let us dig a bit deep into Dynamic Actions by explaining the entries to be done against the dynamic action to be performed. As you know from the last post on the topic(SAP HR – Understanding Dynamic Actions), the view maintained for triggering the dynamic actions is V_T588Z. Lets go step by step and see how it works.
Open the view in maintenance mode(SM30). A new popup will come for Infotype. Pass the Infotype for which you want to maintain the Dynamic Action. I am taking example for a custom Infotype 9800.Press Enter.
Now maintenance screen will open for view V_T588Z. Click on New Entries.
Field contains below 6 columns:
1. Sty: This column is to maintain Dynamic Action for Specific Subtype. If user need to execute the Dynamic Actions based on specific Subtype then this column need to be filled else it can be blank.
2. Field Name: Column to specify field name, if require to process Dynamic Actions.
3. Function Character of step: This column is important part of Dynamic Actions. It’s specified on which action (Create/Change/Delete), dynamic action need to be called.
This column required to fill with two digit of below numbers as per the requirements.
00 – An action is carried out irrespective of whether specified Infotype was created/Changed/deleted.
02 – For Change
04 – For Create
06 – For Change and Create
08 – For Delete
10 – For Change and Delete
12 – For Create and Delete
4. Sequence Number: To determine the sequence of each step
5. Indicator of Step: Below are the available indicators.
P – Check conditions
I – Maintain infotype record
W – Set default values when creating a new record
V – Reference to another step
F – Call routine
M – Send mail
6. Variable Function part: Another important column which contains the steps and definition on the based of previous column ‘Indicator of Step’.
If maintained Indicator of Step Column as ‘P’ Plausibility checks
Here you can enter values for infotype field to check the condition before proceeding the next step. Infotype field values are available in PSAVE structure.
For example to check the Employee Status maintained as below:
Infotype Field ….. Ind. Variable function part
0007 STAT3 P P0007-STAT3=’0′
If maintained Indicator of Step Column as ‘I’ Maintain Infotype record
To create/Change/Delete another infotype ,Enter the step, infotype, subtype, object ID, start and end dates of the record and an indicator which defines whether the step is to be run in the background.
Separate the indicator for suppressing dialog from other entries by a slash D (/D).
9800…. I INS,6,,,(P9800-BEGDA),(P9800-ENDDA)
Step: Create a Infotype record (0006) without subtype and object ID. The start and end dates are the same as those in the current Infotype (9800); specify these two fields only if they are filled because the dynamic action was triggered by this Infotype.
If maintained Indicator of Step Column as ‘W’ Default values for new record
This step used to default the variable values for new Infotype.
Set the defaults for the Infotype, subtype, object ID, start and end dates using an ‘I’ step and not a ‘W’ step.
Do not set defaults for Q fields of an Infotype because the values for these fields are derived from the corresponding P fields.
Infotype Subtype ….. FC Ind. Variable function part
0021 2 04 I INS,0015,M430
0021 2 04 W P0015-BETRG=’10000′
When a Family/Related Person record (0021) record with subtype 2 (child) is created, an Additional Payments record (0015) with a default amount of 100.00 is created.
If maintained Indicator of Step Column as ‘V’ Cross-reference to another step
Here, you can combine fields to groups. The variable function part contains the value in the field which follows the “field” column. Steps which are specified only for the following field are also triggered for each of the other fields.
Infotype Field FC Ind. Variable function part
0016 PRBZH 06 V PRBZT
0016 PRBZT 06 I DEL,0019,01/D
Infotype 0019, subtype 01 is deleted in the background when the field PRBZT or PRBZH in infotype 0016 is changed or created (function code 06).
If maintained Indicator of Step Column as ‘F’ Call a routine.
Sometimes user wants to do some complex validations before processing the Dynamic action which can not be easily maintained in V_T588Z. IN that case, developer can developed a ABAP programs in a routine and called the routine in Dynamic Actions.
Below is the syntax to call the routine,
Infotyp ….. Ind. Var. function part
0001 F GET_DATE(ZPUDYN01)
GET_Date is the routine name in ABAP program ZPUDYN01.
If maintained Indicator of Step Column as ‘M’ – Send a mail
Enter the name of the feature which defines the characteristics of the mail.
Infotype Field ….. Ind. Var. function part
0001 SACHP M M0001
A mail is sent when the field SACHP is changed. The characteristics of the mail are defined in feature M0001
Let’s take a scenario, Whenever user Create or Change Infotype 9800, Infotype 6 need to be created. So Maintain entries in V_T588Z as below.
Now create a new record for IT9800. Now as you press save, dynamic action will be triggered and a new window will open to maintained Infotype 0006.
You can restrict the Infotype creation on the basis of Subtype and also suppress the dialog by executing it in background using ‘/D’.( lets say, in our example: INS,6,,,(P9800-BEGDA),(P9800-ENDDA)/D ).