<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create multiple variants via RS_CREATE_VARIANT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-multiple-variants-via-rs-create-variant/m-p/12619263#M2012445</link>
    <description>&lt;P&gt;That's an internal limit (internally, the program ZTEST is loaded into the memory of the internal session, its parameter and select-option values are modified by RS_CREATE_VARIANT, and if you don't explicitly pass a value to a parameter/select-options it will keep the last one).&lt;/P&gt;&lt;P&gt;You must pass the values of all parameters and select-options. Add this, and you'll see that PARAM2 takes the value abap_false:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      ls_variant_content-selname = 'PARAM2'.
      ls_variant_content-low = abap_false.
      APPEND ls_variant_content TO lt_content.
&lt;/CODE&gt;&lt;/PRE&gt;NB: minimal reproducible example (program creates variants on itself):&lt;PRE&gt;&lt;CODE&gt;REPORT ztesttest.
PARAMETERS param1 AS CHECKBOX.
PARAMETERS param2 AS CHECKBOX.
DATA ls_variant_content type rsparams.
DATA lt_content type table of rsparams.
DATA ls_description type varid.
DATA lt_text type table of varit.
      ls_variant_content-kind = 'P'.
      ls_variant_content-selname = 'PARAM1'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
      ls_variant_content-selname = 'PARAM2'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
ls_description = VALUE #(
    report     = sy-repid
    variant    = 'TEST'
    transport  = 'F'
    ENVIRONMNT = 'A' ).
lt_text = VALUE #( ( VALUE #( BASE CORRESPONDING #( ls_description )
                     langu = sy-langu
                     vtext = 'test' ) ) ).
       CALL FUNCTION 'RS_CREATE_VARIANT'
         EXPORTING
           curr_report               =   ls_description-report
           curr_variant              =   ls_description-variant
           vari_desc                 =   ls_description 
         TABLES
           vari_contents             =    lt_content  
           vari_text                 =    lt_text.    
      COMMIT WORK.
............
      REFRESH lt_content.
      ls_variant_content-kind = 'P'.
      ls_variant_content-selname = 'PARAM1'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
      ls_variant_content-selname = 'PARAM2'.
      ls_variant_content-low = abap_false.
      APPEND ls_variant_content TO lt_content.
ls_description-variant = 'TEST1'.
lt_text = VALUE #( ( VALUE #( BASE CORRESPONDING #( ls_description )
                     langu = sy-langu
                     vtext = 'test' ) ) ).
       CALL FUNCTION 'RS_CREATE_VARIANT'
         EXPORTING
           curr_report               =   ls_description-report
           curr_variant              =   ls_description-variant
           vari_desc                 =   ls_description
         TABLES
           vari_contents             =    lt_content  
           vari_text                 =    lt_text.    
   COMMIT WORK.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Jul 2022 07:58:46 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2022-07-14T07:58:46Z</dc:date>
    <item>
      <title>Create multiple variants via RS_CREATE_VARIANT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-multiple-variants-via-rs-create-variant/m-p/12619262#M2012444</link>
      <description>&lt;P&gt;Hi team.&lt;/P&gt;
  &lt;P&gt;I'm trying to create multiple variants in single session via FM 'RS_CREATE_VARIANT' . I noticed that the variants created in that way can inherited part of parameters from previously created item. Below some example.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;      ls_variant_content-kind = 'P'.
      ls_variant_content-selname = 'PARAM1'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
      ls_variant_content-selname = 'PARAM2'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
       CALL FUNCTION 'RS_CREATE_VARIANT'
         EXPORTING
           curr_report               =    'ZTEST'              " Report Name
           curr_variant              =    'TEST'              " Variant name
           vari_desc                 =   ls_description               " Variant description (structure VARID)
         TABLES
           vari_contents             =    lt_content              " Contents (STRUCTURE RSPARAMS)
           vari_text                 =    lt_text              " Variant text (structure VARIT)
      COMMIT WORK.
............
      REFRESH lt_content.
      ls_variant_content-kind = 'P'.
      ls_variant_content-selname = 'PARAM1'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
       CALL FUNCTION 'RS_CREATE_VARIANT'
         EXPORTING
           curr_report               =    'ZTEST'              " Report Name
           curr_variant              =    'TEST1'              " Variant name
           vari_desc                 =   ls_description               " Variant description (structure VARID)
         TABLES
           vari_contents             =    lt_content              " Contents (STRUCTURE RSPARAMS)
           vari_text                 =    lt_text              " Variant text (structure VARIT)
   COMMIT WORK.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;For the example above variant TEST1 has Param1 = X what is ok and also PARAM2 = X which I don't send to function. Do You know why and how I can avoid it (without to send PARAM2 = space )&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 21:28:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-multiple-variants-via-rs-create-variant/m-p/12619262#M2012444</guid>
      <dc:creator>szymon_glapiak</dc:creator>
      <dc:date>2022-07-13T21:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple variants via RS_CREATE_VARIANT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-multiple-variants-via-rs-create-variant/m-p/12619263#M2012445</link>
      <description>&lt;P&gt;That's an internal limit (internally, the program ZTEST is loaded into the memory of the internal session, its parameter and select-option values are modified by RS_CREATE_VARIANT, and if you don't explicitly pass a value to a parameter/select-options it will keep the last one).&lt;/P&gt;&lt;P&gt;You must pass the values of all parameters and select-options. Add this, and you'll see that PARAM2 takes the value abap_false:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      ls_variant_content-selname = 'PARAM2'.
      ls_variant_content-low = abap_false.
      APPEND ls_variant_content TO lt_content.
&lt;/CODE&gt;&lt;/PRE&gt;NB: minimal reproducible example (program creates variants on itself):&lt;PRE&gt;&lt;CODE&gt;REPORT ztesttest.
PARAMETERS param1 AS CHECKBOX.
PARAMETERS param2 AS CHECKBOX.
DATA ls_variant_content type rsparams.
DATA lt_content type table of rsparams.
DATA ls_description type varid.
DATA lt_text type table of varit.
      ls_variant_content-kind = 'P'.
      ls_variant_content-selname = 'PARAM1'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
      ls_variant_content-selname = 'PARAM2'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
ls_description = VALUE #(
    report     = sy-repid
    variant    = 'TEST'
    transport  = 'F'
    ENVIRONMNT = 'A' ).
lt_text = VALUE #( ( VALUE #( BASE CORRESPONDING #( ls_description )
                     langu = sy-langu
                     vtext = 'test' ) ) ).
       CALL FUNCTION 'RS_CREATE_VARIANT'
         EXPORTING
           curr_report               =   ls_description-report
           curr_variant              =   ls_description-variant
           vari_desc                 =   ls_description 
         TABLES
           vari_contents             =    lt_content  
           vari_text                 =    lt_text.    
      COMMIT WORK.
............
      REFRESH lt_content.
      ls_variant_content-kind = 'P'.
      ls_variant_content-selname = 'PARAM1'.
      ls_variant_content-low = abap_true.
      APPEND ls_variant_content TO lt_content.
      ls_variant_content-selname = 'PARAM2'.
      ls_variant_content-low = abap_false.
      APPEND ls_variant_content TO lt_content.
ls_description-variant = 'TEST1'.
lt_text = VALUE #( ( VALUE #( BASE CORRESPONDING #( ls_description )
                     langu = sy-langu
                     vtext = 'test' ) ) ).
       CALL FUNCTION 'RS_CREATE_VARIANT'
         EXPORTING
           curr_report               =   ls_description-report
           curr_variant              =   ls_description-variant
           vari_desc                 =   ls_description
         TABLES
           vari_contents             =    lt_content  
           vari_text                 =    lt_text.    
   COMMIT WORK.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jul 2022 07:58:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-multiple-variants-via-rs-create-variant/m-p/12619263#M2012445</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-07-14T07:58:46Z</dc:date>
    </item>
  </channel>
</rss>

