Application Development 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: 

Cannot create params from one Z PROGRAM to another Z with RS_CREATE_VARIANT

mariano_sabiche
Active Participant
0 Kudos
356

Dear Guru's;

I have created a ZPROGR1 to create VARIANTS with PARAMS to another ZPROGR2 with the FM RS_CREATE_VARIANT. The results are that with ZPROG1 creates variant for ZPROG2 but without parameters. I test the ZPROG1 a lot of times without success. I use SE37 with RS_CREATE_VARIANT and runs fine.

The code lines are:

REPORT  ZPROG1.
  DATA:
       G_REPORT      LIKE  RSVAR-REPORT VALUE 'ZPROG2',
       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'.
<br>

Please, help me.

Best regards,

Mariano

1 REPLY 1

raymond_giuseppi
Active Contributor
0 Kudos
207

You forgot the SIGN and OPTION fields of VARI_CONTENTS records, try 'I' 'EQ'.