You are on page 1of 7

How to create a Dynamic variant and setup batch job with

dynamic variant
January 4, 2010 | 2,997 Views |

Vinod Vemuru
more by this author
Retagging required
vinod vemuru2

share 0
share 0
tweet
share 0

Follow

Whenever we start a program in which, selection screens are defined, system displays a set of input
fields based on which data is selected, manipulated and displayed or updated. To select the required data,
we will enter appropriate inputs in the selection screen. Variant maintenance allows us to save these set of
input values for programs that we often start with so that we need not enter all the selection screen values
each time we run the program.
There are situations where we may not run the program on adhoc basis but we may need to schedule the
job with a variant.

If we have input fields like date, time etc we may need these field values to be populated dynamically.
This blog discusses on how to create a dynamic variant and set up a batch job with this dynamic variant.

How to create a dynamic variant


Following steps is to be followed for creating a dynamic variant. In this example I have considered date
field as the dynamic selection screen variable.

First fill in all the selection screen data and save the data as variant.
Give some variant name and description. Select the check box corresponding to the Date range as selection
variable (L). Next press push button selection variables in the tool bar.

Click on the yellow light corresponds to column D(Stands for Dynamic). It will become green colour.
Then press the down arrow at the end of the date range.
It will display a popup for various calculations. Select any one based on the requirement.

E.g. We need to run a report for past one weeks data. So I have chosen to calculate the low date as
7 days prior to the run date and high value as the run date of the report.
When we press enter next screen will appear like below with low and high values. Now press save, you
will go back to the previous screen.

Now save this variant.


This finishes the first step i.e. creating the dynamic variant.

How to set up a batch job with dynamic variant


Now we have to schedule a batch job which will be executed as a weekly batch job with this dynamic
variant so that the dates will change accordingly as per the run date of the report. Go to transaction SM36,
Fill in the initial screen details like job name, job class. Next press the Start condition push button in the
tool bar.
Next schedule the job as per the requirement. Here I am doing it as weekly batch job. Fill in the scheduled
start date and time, Press the periodic values push button in the bottom of the window. Select the
frequency in the popup(weekly) and save it.Next press push button STEP in the tool bar. Give the ABAP
program name, Variant name, language and save the job.
Now we will get a message saying batch job is scheduled. So the batch job will run weekly with low date
as current date 7 days and high date as current date.
NOTE: Screens may vary in different versions of SAP. These are taken from 4.6C version.

You might also like