Skip to Content

Dynamic Variant Creation in SAP ABAP

Dynamic Variant Creation:

What is Variants?

Variants allow you to save sets of input values for programs that you often start with the same selections.

Purpose of dynamic variants

Sometimes you may have a requirement to schedule a back ground jobs, based on the current month in the selection screen.

Ex: You want to run your Payroll interface based on the pay periods, so you may need to have a variant for different month.

To overcome the above scenario, SAP has given more flexibility to do the things. Here in this document, I will cover how to create variant that changes dynamically based on the calendar month.

Variant creation Steps

Transaction code for creating report variant: SE38

  1. 1. Go to SE38, enter the report program name and select radio buttons “variants” and press Display

Note: There are few different ways of creating report variants, out of which below example is one way of doing it.

/wp-content/uploads/2012/06/1_108248.png

2. Enter desired variant name, in below screen represented as “DEMO_DYNAMIC” and Press Create.

/wp-content/uploads/2012/06/2_108249.png

3. You will be taken to the below screen, press Attributes button to maintain your dynamic variables.

/wp-content/uploads/2012/06/3_108250.png

4. Go to selection variable (as shown below) and press F4 (value help) and select D (i.e. for dynamic date calculation)

/wp-content/uploads/2012/06/4_108251.png

5. Press F4, under “Name of Variable (input Only Using F4), you will be taken to the below highlighted screen.

/wp-content/uploads/2012/06/5_108252.png


6. You choose the respective variable that suits your requirement.

Now, Let us assume that in our scenario we want to select the date range for start day of previous month and end day of current month.

Double click the variable that matches our scenario (as shown below)

/wp-content/uploads/2012/06/6_108253.png

On pop-up screen enter the value as shown in below screen.

Here XXX = 1 represents, [current month – 1].

YYY = 0 represents, [current month + 0].

Press Continue

/wp-content/uploads/2012/06/7_108257.png

7. Press Save.

/wp-content/uploads/2012/06/8_108258.png

8. Now you will see the desired results.

Server date: /wp-content/uploads/2012/06/9_108259.png

Result:

/wp-content/uploads/2012/06/10_108260.png




1 Comment
You must be Logged on to comment or reply to a post.