Wednesday, December 22, 2010
Variant can be created using function module RS_CREATE_VARIANT.

REPORT  ztest_program.
DATA:
    g_report      LIKE  rsvar-report VALUE sy-repid,
    g_variant     LIKE  rsvar-variant VALUE 'TEST_VAR1',
    g_vari_desc   LIKE  varid.
DATA:
    it_rsparams   TYPE STANDARD TABLE OF  rsparams,
    wa_rsparams   LIKE LINE OF it_rsparams,
    it_vari_text  TYPE STANDARD TABLE OF varit,
    wa_vari_text  LIKE LINE OF it_vari_text.
PARAMETERS :p_name   TYPE char15.

AT SELECTION-SCREEN.
  IF sy-ucomm = 'ONLI'."Variant is created when you press EXECUTE button on selection-screen.
    wa_vari_text-langu     =  'EN'.
    wa_vari_text-report    =  g_report.
    wa_vari_text-variant   =  g_variant.
    wa_vari_text-vtext     =  'Test variant'.
    APPEND wa_vari_text TO it_vari_text.
    CLEAR wa_vari_text.

    g_vari_desc-report     = g_report.
    g_vari_desc-variant    =  g_variant.
    g_vari_desc-environmnt = 'A'.
    g_vari_desc-aedat      = sy-datum.
    g_vari_desc-aetime     = sy-uzeit.

    wa_rsparams-selname    = 'P_NAME'.
    wa_rsparams-kind       = 'P'.
    wa_rsparams-low        = p_name.
    APPEND wa_rsparams TO it_rsparams.
    CLEAR wa_rsparams.

    CALL FUNCTION 'RS_CREATE_VARIANT'
      EXPORTING
        curr_report   = g_report
        curr_variant  = g_variant
        vari_desc     = g_vari_desc
      TABLES
        vari_contents = it_rsparams
        vari_text     = it_vari_text.
  ENDIF.

START-OF-SELECTION.
  WRITE 'Variant created'.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.