X

SAP Dynamic Actions

Welcome to the tutorial on SAP Dynamic Actions. SAP Dynamic actions are provided to enable us to initiate certain actions whenever a certain infotype is maintained.

This tutorial is part of our free SAP HCM course.

Below are the various types of actions that can be initiated:

  • Maintenance of another infotype/subtype
  • Sending an email
  • Calling a routine

In this tutorial, we will focus on the first action. The rationale for this is that the first action can be configured independently by a functional consultant, whereas implementing the others will need help from ABAP developer.

Standard SAP Dynamic Actions

SAP provides several pre-configured SAP dynamic actions. Let’s consider an example:

If you have maintained the Personal data infotype (infotype 0002) for an employee in SAP, you may have observed that whenever the marital status is saved as “Married”, the system automatically proposes the creation of the Family member/dependents infotype (infotype 0021), subtype “Spouse”.

This has been depicted in the following screenshots.

Here, Figure 1 shows the Marital status being updated as “Married” using transaction code PA30 (Maintain HR master data).

Figure 1: Transaction PA30 – Changing Marital Status

On saving the record, the Create Family Member/Dependents screen is automatically displayed, as you can see in Figure 2. The subtype proposed is ‘Spouse’.

Figure 2: Creation of Family Member/Dependents Automatically Proposed

Now, the mechanism behind this behaviour is a simple SAP Dynamic action that has been pre-configured in the system. In the next section, we will look at how SAP Dynamic actions like this one can be configured.

Configuration of SAP Dynamic Actions

The configuration of SAP dynamic actions is done in Customizing using transaction code SPRO. Follow the path mentioned below and depicted in Figure 3:

Personnel Management – Personnel Administration – Customizing Procedures – Dynamic Actions

Figure 3: Dynamic Actions Path in SPRO

When you click on the Activity “Dynamic Actions”, it will take you to the screen in Figure 4.

Figure 4: Dynamic Actions Configuration

To see the configuration of the dynamic action explained in the previous section, click on the ‘Position’ icon that has been highlighted in the above screenshot. This will take you to the pop-up shown in Figure 5.

Figure 5: Position Pop-Up Dialog

Now, one question that may arise here is, which infotype should one enter in the above screenshot? The answer is this – we need to search for the infotype that triggers the action, not the infotype being triggered by the action. So, in our example, we should search for Infotype 0002 (Personal data).

Figure 6: Searching for Infotype 0002 (Personal Data)

You will see several dynamic actions for Infotype 0002 as shown in Figure 7.

Figure 7: Dynamic Actions for Infotype 0002

To find out which dynamic action is relevant to our example, let us first understand the meaning and purpose of the various columns in this table. Look at the first three columns in this table, as highlighted in Figure 8.

Figure 8: Infotype, Subtype, Field

These columns respectively contain the Infotype, subtype and field that trigger the Dynamic action.

The column ‘Infotype’ is mandatory, as a dynamic action is triggered only on saving an infotype.

The column ‘Subtype’ is optional and must be filled only if the Dynamic action should be triggered on saving a particular subtype of the infotype.

The column ‘Field’ is also optional, and should be filled only if the Dynamic action should be triggered on saving a particular field of the infotype.

Now, in our example, the Dynamic action is triggered on saving the ‘Marital status’ field in the infotype. Hence let us further refine our search based on this field. Before doing this, we should find out the technical name of the field. To do this, execute transaction code SE11 and enter PA0002 as the Database table. PA0002 is the table that corresponds to infotype 0002 (Personal data). Click on the Display icon shown in Figure 9.

Figure 9: Display PA0002

This will take you to the screen shown in Figure 10. Search the Short description column for the Marital status field, we have highlighted it in the screenshot. You can see the field name is FAMST.

Figure 10: Field Name

Let’s use this field name to refine our search for the relevant Dynamic action as shown in Figure 11.

Figure 11: Searching Using Infotype and Field Name

Searching with both criteria, that is, Infotype 0002 (Personal data) and Field name FAMST (Marital status), takes us to the screen shown in Figure 12.

Figure 12: SAP Dynamic Action for Infotype 0002 and Field FAMST

Again, there are several entries for this combination of infotype and field. We will now try to understand the significance of the balance four columns of this table.

Function Character – This column is highlighted in Figure 13. This indicates the infotype processing type for which the dynamic action should be triggered.

Figure 13: Function Character

It can have the following values:

00 – Independent of processing type

02 – Change

04 – Create

06 – Change and Create

08 – Delete

10 – Change and Delete

12 – Create and Delete

For example, if you enter the Function character 02, the dynamic action will be triggered when the specified infotype is changed.

If you enter the Function character 06, the dynamic action will be triggered when the specified infotype is created as well as when it is changed.

The next three columns indicate the Sequence number, Step and Variable function part. While Sequence number is self-explanatory, the Step and Variable function part columns need a detailed explanation and hence we have dedicated a sub-section to these two columns.

Step and Variable Function Part

Step can be assigned any of the below possible values:

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

Any other entry in this column indicates a comment line.

Of all the above values, just the values ‘P’, ‘I’ and ‘W’ are relevant to our example and these will be explained in detail.

The Variable Function Part depends on the Step column and accordingly has the below meaning:

Plausibility Checks (Step =’P’)

If Step contains the value ‘P’ (Check conditions), the Variable function part should specify the condition that must be checked. Only if this condition is satisfied will the processing of the Dynamic action continue. Simply put, it is like an IF <condition> statement, where the condition is specified in the Variable function part.

You can also specify that multiple conditions need to be satisfied so that processing of the Dynamic action continues. In this case, each condition should be listed in a different line, with a different sequence number.

Alternatively, you may need to specify that at least one of a list of conditions needs to be satisfied so that processing of the Dynamic action continues. In this case, each condition will be listed in a different line, with a different sequence number, as well as a Logical OR link. This Logical OR is indicated with a /X after the condition.

Maintain Infotype Record (Step = ‘I’)

If Step contains the value ‘I’ (Maintain infotype record), the Variable function part will specify the details of the infotype to be maintained using the following format:

Action, infotype, subtype, object id, start date, end date, indicator.

The possible actions are:

INS – Specified infotype record will be created

COP – Specified infotype record will be copied

MOD – Specified infotype record will be changed

DEL – Specified infotype record will be deleted

The indicator is used to specify if SAP dynamic actions should be executed in the background. If yes, then specify /D, else leave the indicator blank.

Default Values for New Record (Step = ‘W’)

Use this to set a default value for any field in the newly maintained infotype record. This is excluding the defaulting of infotype, subtype, object ID, start date, end date, as these are defaulted using the ‘I’ step explained above and not the ‘W’ step.

Now, let’s go back to analyse the configuration of SAP Dynamic action in our example.

Figure 14: SAP Dynamic Action Configuration in Our Example

Please refer to the highlighted set of lines in Figure 14. All these lines are called when the field FAMST (Marital status) in Infotype 0002 (Personal data) is created or changed. Now let’s understand how these lines work together.

1. The lines numbered 100, 104, 105 are Plausibility check lines with a Logical OR linking as demonstrated by the ‘/X’ at the end of each variable function part.

This means the System will check if:

  • The country grouping (T001P-MOLGA) is ‘99’ OR
  • The previous value (indicated by PSAVE-) of the Marital status field (FAMST) is not blank OR
  • The previous value (indicated by PSAVE-) of the Marital status field (FAMST) is not ‘1’ (Here ‘1’ is the code for ‘Married’)

If none of the above conditions are satisfied, the dynamic action will not be processed further.

Otherwise, that is, if at least one of the above three checks is true, the system will process the line numbered 106.

2. The line numbered 106 checks if the Marital status currently being saved (P0002-FAMST) is ‘1’, that is “Married’.

If no, the dynamic action will not be processed further. Otherwise, the system will process the line numbered 107.

3. The line numbered 107 creates a new infotype 0021 (Family members/dependents), subtype 1 (spouse) record with start date = start date of infotype 0000 (Actions) and end date = end date of infotype 0000 (Actions).

Since there is no background indicator (‘/D’), at the end of this line, the system proposes the creation of the infotype in the foreground as we have seen in Figure 2.

Did you like this tutorial? Have any questions or comments? We would love to hear your feedback in the comments section below. It’d be a big help for us, and hopefully it’s something we can address for you in improvement of our free SAP HR tutorials.

Navigation Links

Go to next lesson: SAP Infotype Change Log

Go to previous lesson: SAP Organizational Key

Go to overview of the course: SAP HR Training

View Comments (5)

  • Hello,
    I am having one requirement which needs to be performed through Dynamic Action in which when IT0008 record is unlock (P0008-SPRPS), IT0105 screen should get populated.
    Please help.
    Regards,
    Milind

  • Hi Experts ,
    I want to make an mandatory field optional on the basis of nationality of the employee.

    Thanks & Regards ,

    Naresh Sadhanala

  • Greetings everyone,
    I have used the /D to execute in background, but still executes in foreground??? Appreciate any hints.

    COP,9900,0000/D
    Also i tried INS,9900,0000,,(P9900-BEGDA),(P9900-ENDDA)/D

    in every sceario i tried the intented infotype 9900 subty 0000, still pops up as if executing in foregraound. Looks like the '/D' won't work.