Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
TanmayVerma
Active Participant

In previous blogs we learnt about the types of selection screen variant, variant attribute and their uses.

Previous Blogs in the series:


Selection Screen Variants - Part I


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:





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.


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



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


  • 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.

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.

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.

Suggestions and comments welcomed.

~Tanmay

3 Comments