<?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: Call variant from ABAP program in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061079#M91894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; you can use function module below to get the values for the variant user has created&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN OUTPUT.  &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'RS_VARIANT_CONTENTS'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        report               = Report Name&lt;/P&gt;&lt;P&gt;        variant              = Variant name&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        valutab              = it_valutab&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        variant_non_existent = 1&lt;/P&gt;&lt;P&gt;        variant_obsolete     = 2&lt;/P&gt;&lt;P&gt;        OTHERS               = 3.&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then LOOP AT IT_VALUTAB INTO WA_VALUTAB WHERE SELNAME = 'YOUR FIRST SELECT OPTION NAME such as S_VBELN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           MOVE WA_VALUTAB-SIGN,WA_VALUTAB-OPTION, WA_VALUTAB-LOW, WA_VALUTAB-HIGH to the corresponding fields of your select option i.e. S_VBELN.&lt;/P&gt;&lt;P&gt;    APPEND S_VBLEN.&lt;/P&gt;&lt;P&gt;   ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly Loop at IT_VALUTAB for the remaining fields on the selection screen and append the values in the select options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please award points if it solves your problem.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;sharmistha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Nov 2005 22:59:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-09T22:59:53Z</dc:date>
    <item>
      <title>Call variant from ABAP program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061076#M91891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;The users have created a variant that they use when they run their report.  When they select the variant it works fine, but they want the program to run the variant for them.  Can anyone give me some ideas as to where I can go to see some sample code, so I can try to figure out how to do this, please? &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2005 22:36:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061076#M91891</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-09T22:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Call variant from ABAP program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061077#M91892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can select the Variant values in the INITIALIZATION event of the program, if you know the name of the variant. There are useful function modules in the function group SVAR. Or, search rs_variant_*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Bhanu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2005 22:41:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061077#M91892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-09T22:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Call variant from ABAP program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061078#M91893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Olivia - we create a number of variants and then name them according to the USERIDs of the users that will be running the program. In the program, at the         INITIALIZATION event, we call FM RS_SUPPORT_SELECTIONS using the report name and variant name. The program then starts with the individual user's defaults.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2005 22:45:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061078#M91893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-09T22:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Call variant from ABAP program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061079#M91894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; you can use function module below to get the values for the variant user has created&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN OUTPUT.  &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'RS_VARIANT_CONTENTS'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        report               = Report Name&lt;/P&gt;&lt;P&gt;        variant              = Variant name&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        valutab              = it_valutab&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        variant_non_existent = 1&lt;/P&gt;&lt;P&gt;        variant_obsolete     = 2&lt;/P&gt;&lt;P&gt;        OTHERS               = 3.&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then LOOP AT IT_VALUTAB INTO WA_VALUTAB WHERE SELNAME = 'YOUR FIRST SELECT OPTION NAME such as S_VBELN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           MOVE WA_VALUTAB-SIGN,WA_VALUTAB-OPTION, WA_VALUTAB-LOW, WA_VALUTAB-HIGH to the corresponding fields of your select option i.e. S_VBELN.&lt;/P&gt;&lt;P&gt;    APPEND S_VBLEN.&lt;/P&gt;&lt;P&gt;   ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly Loop at IT_VALUTAB for the remaining fields on the selection screen and append the values in the select options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please award points if it solves your problem.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;sharmistha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2005 22:59:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061079#M91894</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-09T22:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Call variant from ABAP program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061080#M91895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use SET/GET parameter: create a Z-PARAMETER where the variant name'll be stored, insert this PARAMETER in the own data of user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then create a new program that'll run the main program using user variant:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZREPORT1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GET PARAMETER ID 'ZVARIANT' FIELD VARIANT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUBMIT ZREPORT2&lt;/P&gt;&lt;P&gt;       VIA SELECTION-SCREEN&lt;/P&gt;&lt;P&gt;       USING SELECTION-SET VARIANT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should insert a piece of code to check if the variant exists (see the fm RS_VARIANT*)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: max bianchi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2005 23:23:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061080#M91895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-09T23:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Call variant from ABAP program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061081#M91896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the thread helped you, please award the points and close the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bhanu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2005 20:07:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-variant-from-abap-program/m-p/1061081#M91896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-21T20:07:05Z</dc:date>
    </item>
  </channel>
</rss>

