Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Varient Creation through Button

Former Member
0 Likes
767

Hi All,

I have a small requirement on Varient Creation, I need to create or change or Delete a Varient through Button.Can any one suggest to me.

Thank you,

Usha.G

7 REPLIES 7
Read only

Former Member
0 Likes
723

Can you explain a little bit more about your small requirement?

Which button you are talking about and where you want that button to be?

Regards

Karthik D

Read only

0 Likes
723

Hi Karthik,

Thank you for the quick reply.I wanted to create normal Button.This should be standard SAP capabilities... ability to create, delete, change variants and execute the program in foreground or background with the chosen variant.

Thank You,

Usha

Read only

0 Likes
723

Hi Usha, <li>Below function modules are used to do.

RS_CREATE_VARIANT
RS_VARIANT_DELETE
RS_VARIANT_CHANGE
<li>Use the below program to create variant dynamically by giving input and execute.
    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'.
Thanks Venkat.

Read only

0 Likes
723

Hello Venkat,

Thank you for your Reply. I need to give varient name in selection screen not a default value. When i removed default value 'TEST_VAR1' it is executing but not creating varient.

Thank You,

Usha.G

Read only

0 Likes
723

Hi Usha,

That is just example. You need to keep one field for variant on selection-screen instead defaulting what i did in example. so that you can give your variant name yourself on S-S.

Thanks

Venkat.O

Read only

Former Member
0 Likes
723

Ans

Read only

Former Member
0 Likes
723

Ans