Thursday, 22 September 2016

Selection Screen Variants - Part III

My Previous Blogs in the series:

1. Selection Screen Variants - Part I
2. Selection Screen Variants - Part II

Dynamic Variants: The values in such variants are dynamic and can vary over time.

How to use table TVARVC for dynamic variants?: The table TVARVC can be used for creating variants where input data needs to be changed frequently.

We have to first maintain high and low values for a field in the table TVARVC .Transaction STVARVC can be used to maintain  these values in client 000. In other clients the table can be directly maintained in SM30.

This values can be then used in variants while saving the variant attributes.

To create dynamic value for any field, Click on Selection variable and then press F4.

The F4 for the selection variable shows the following options.

T – Table Variable for TVARVC

D –  Dynamic data calculation.

When T is selected values will be  fetched from TVARVC table . Press 'F4' on 'Name of Variable' for the field and select the desired entry.
When D is selected  it corresponds to dynamic date calculations and hence is suitable for date fields.

For example if we have the selection screen as below:

Selection Screen Variants - Part III

We saving a variant we can make the values dynamic as follows:
  • Select the field for which dynamic values are required and press value help for selection variable.

Selection Screen Variants - Part III

On pressing the F4 help the options are displayed in pop-up window.

Selection Screen Variants - Part III

Select 'T' for TVARVC and the select the variable name using 'F4' help.

Selection Screen Variants - Part III
  • The date field can be made dynamic by following the below steps:
  • Select the selection variable as 'D'.
  • Select the attribute value using F4 help. Here in the example we set the date field value equals to the current date.

Selection Screen Variants - Part III

Selection Screen Variants - Part III

One the variant is saved and report is executed:
  • The material value will be filled from TVARVC entry chosen.
  • The date will be defaulted to current date.

Running the report using the saved variant.

Selection Screen Variants - Part III

Function Modules Related to Variants:
  • Below Function modules can be used can be used in report programs as per the requirements.

Function Module Description
RS_CREATE_VARIANT To create variants for reports
RS_VARIANT_EXISTS To check whether a variant exists for a report
RS_VARIANT_CATALOG Returns the variant list for a report in an internal table
RS_VARIANT_FETCH To get the variant attributes of an existing variant
RS_VARIANT_COPY To copy an existing variant
RS_CHANGE_CREATED
_VARIANT

To change the contents of an existing variant
RS_VARIANT_CONTENTS To get the variant contents
RS_VARIANT_ATTR_SAVE To save the variant attributes. Helpful for dynamic variants
RS_VARIANT_VALUE_SAVE To save the variant values.

No comments:

Post a Comment