Dynamic date manipulation for Variant in SAP ABAP

Author | Last Updated| | 6 Comments Facebook Share Twitter Share Google Plus Share A+ A-


Dynamic date manipulation in variants in SAP ABAP, update variant date dynamically in SAP ABAP variants

Step1:Creating Variants for SAP ABAP programs Normal Top^

Variant is a concept of saving a set of input fields with values with a particular name, so that we can use the same set of inputs next time, the below is the example of creating variants in SAP ABAP programs.

Create a program with a selection-screen.

REPORT ZSAPN_DYNAMICDATE.
DATA LV_DATUM TYPE DATUM.
PARAMETERS P_DATE TYPE DATUM.
SELECT-OPTIONS S_DATE FOR LV_DATUM.

Creating variants in SAP ABAP reports

Provide some input values, click on save button.

Creating variants in SAP ABAP reports

Provide variant name, description and save.

Creating variants in SAP ABAP reports

How to use variant in SAP ABAP programs

Go to the program selection screen, you will find variant icon, click on variant icon.

Creating variants in SAP ABAP reports

You will find list of variants available for the program, double click on any variant, the values will be populated to screen automatically.

Creating variants in SAP ABAP reports

Creating variants in SAP ABAP reports

Step2:Dynamic date in variant for parameters Normal Top^

Go to report selection screen.

Provide some input values, click on save button.

Dynamic date in variants in SAP ABAP

Press F4 on selection variable input of parameter date,select D:Dynamic Date Calculation, enter.

Dynamic date in variants in SAP ABAP

Press enter, press F4 on name of variable, double click on  current date +/- ??? days.

Dynamic date in variants in SAP ABAP

A pop up will open enter -1, means current date -1..(todays date -1, changes dynamically everyday).

Dynamic date in variants in SAP ABAP

Save the variant, go to report selection-screen select variant by clicking on variant, you will find yesterdays date on selection screen, this will changes dynamically every day.

Tutorial Comments

Total Comments: Add your Comment
29 Mar 2018

Nice to see more information about variant.. actually we do date calculation in initialization event.

29 Mar 2018

This is new for me. Thanks for sharing.

29 Mar 2018

i want know how to use variant in background session ? please if you know email me ? thank you.

29 Mar 2018

Nice topics. Please it will be better some scenarios

29 Mar 2018

Thank you very much.........................................................

31 May 2018

I believe this is one of the most vital information for me. And i am satisfied studying your article. But should observation on some normal things, The site taste is ideal, the articles is truly great : D. Just right activity, cheers juventus tröja

Leave a Comment

Enter Comment Text