Wednesday, April 20, 2011

Dynamic Variant in a report

Scenario: This blog is to explain the creation of Dynamic Variant for report selection screen.

Let us understand ‘What is Dynamic Variant?’ Dynamic Variant consists of selection variable for a selection screen item where in a formula can be defined. For example: On the selection screen of a report, take a Date field, which needs to be dynamic. From Date should be ‘Current date – 15’ and To Date should be ‘Current Date’. In this way the report when run with this variant, it would be possible to retrieve all those records which are past 15 days entries from now.

Please find below the procedure to define DYNAMIC Variant.

Step 1: Go to transaction SE38 to specify the Program name and select ‘Variant’ radio button and ‘Display’.

Then it will lead you to next screen ‘ABAP:Variants –Initial Screen’ as shown below: Specify the variant which needs to be created or changed.

Step2: Specify all those values which are static on the selection screen in this step. Then click ‘Variant Attributes’ to define selection variable for ‘Date Created’ on the selection screen.

Step 3: In this step, provide suitable meaning for the variant. As we need to define selection variable for ‘Date created’ item on selection screen, check the box under L as shown in the selection screen below:

Step 4: In the previous step, select ‘Selection Variables’ on the menu. It leads to the next screen as shown below. As we have decided to create selection variable for ‘Date created’ item only, in this screen you get to see the variable as ‘Date created’. Here you are provided with three options.

T: Table variable from TVARV

D: Dynamic Date Calculation

B: User defined Variables.

From the provided options as per our requirement select ‘D’ option. This can be done by clicking the Traffic lights under ‘D’as shown below to know that the particular option is selected.

Now click the black arrow as shown in the screenshot below and you will be prompted with search help of different formulas for the selection variable.

Step 5: Find the suitable formula as ‘Current date – xxx, current date + yyy’ and select it. This will lead you to the next screen to enter the values for xxx and yyy. So, provide values as 15 for xxx and 0 for yyy. Save the variant and this will conclude the creation of dynamic variant with the help of selection variable. This variant can also be used in the background jobs.

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)


Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive