FM to create variant


DATA: BEGIN OF varid_tab.
      INCLUDE STRUCTURE varid.
DATA: END OF varid_tab.

data lt_varit_tab type table of VARIT.
data ls_varit_tab type  VARIT.

data wt_values type table of RSPARAMS.
data ws_values type RSPARAMS.

varid_tab-report  = 'REPORT_NAME'.
varid_tab-variant = 'VARIANT_NAME'.
varid_tab-environmnt   = 'A'.

ls_varit_tab-mandt   = sy-mandt.
ls_varit_tab-langu   = sy-langu.
ls_varit_tab-report  = varid_tab-report.
ls_varit_tab-variant = varid_tab-variant.

concatenate sy-datum sy-uzeit into
ls_varit_tab-vtext separated by space.

APPEND ls_varit_tab to lt_varit_tab.


* Variant Values
ws_values-selname = 'MAPPE'.
ws_values-low = ''VALUE'.

append ws_values to wt_values.

ws_values-selname = 'VON'.
ws_values-low = 'sy-datum'.

append ws_values to wt_values.

CALL FUNCTION 'RS_CREATE_VARIANT'
      EXPORTING
        CURR_REPORT                     = 'REPORT_NAME'
        CURR_VARIANT                    = 'VARIANT_NAME'
        VARI_DESC                       = varid_tab
      TABLES
        VARI_CONTENTS                   = wt_values
        VARI_TEXT                       = lt_varit_tab

Leave a comment

Your email address will not be published. Required fields are marked *