<?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: Populate SELECT-OPTIONS default value using CALL FUNCTION in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825828#M1470774</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi,
&amp;lt;li&amp;gt;Try this way.
&lt;PRE&gt;&lt;CODE&gt;
REPORT  z_download_bsis_test.
*Data Declaration
DATA: w_currm TYPE bsis-monat.

SELECT-OPTIONS s_currm FOR w_currm.
"DEFAULT w_currm. " The default value is NOT being populated (appears blank)
"-----------------------------------------------------------------------
"Above DEFAULT addition will not default.
"-----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT.

*   *define current fiscal month
  CALL FUNCTION 'GET_CURRENT_YEAR'
    EXPORTING
      bukrs = 'X999'     " Company Code
      date  = sy-datum   " Date to find fiscal year for
    IMPORTING
      currm = w_currm.   " Current Fiscal Month
  IF w_currm IS INITIAL.
    w_currm = sy-datum+4(2)."I just added for test purpose, you can remove
    "You need to build Select-options table like below.
    s_currm-low = w_currm.
    s_currm-option = 'EQ'.
    s_currm-sign = 'I'.
    APPEND s_currm.
    CLEAR  s_currm.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;
&amp;lt;font color=red&amp;gt;Note:&amp;lt;/font&amp;gt; &lt;STRONG&gt;IF w_currm IS INITIAL&lt;/STRONG&gt; and &lt;STRONG&gt;ENDIF&lt;/STRONG&gt; , I used for testing purpose, you can remove
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Venkat.O on Mar 25, 2010 11:22 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Mar 2010 03:07:38 GMT</pubDate>
    <dc:creator>venkat_o</dc:creator>
    <dc:date>2010-03-25T03:07:38Z</dc:date>
    <item>
      <title>Populate SELECT-OPTIONS default value using CALL FUNCTION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825827#M1470773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to populate SELECT-OPTIONS s_currm default with value in w_currm, however, it doesn't seem to work.  Can you please advise what the correct syntax is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that CALL FUNCTION 'GET_CURRENT_YEAR' is working correctly and populating w_currm (as I can use it in a SQL SELECT statement), however, it does not seem to work for SELECT-OPTIONS s_currm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code snippet is as a follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  Z_DOWNLOAD_BSIS_TEST.

*Data Declaration
DATA: w_currm TYPE BSIS-MONAT.

*Define current fiscal month
CALL FUNCTION 'GET_CURRENT_YEAR'
  EXPORTING
    BUKRS         = 'X999'     " Company Code
    DATE          = SY-DATUM   " Date to find fiscal year for
  IMPORTING
    CURRM         = w_currm.   " Current Fiscal Month

SELECT-OPTIONS s_currm FOR w_currm
               DEFAULT w_currm. " The default value is NOT being populated (appears blank) &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 02:57:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825827#M1470773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-25T02:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Populate SELECT-OPTIONS default value using CALL FUNCTION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825828#M1470774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi,
&amp;lt;li&amp;gt;Try this way.
&lt;PRE&gt;&lt;CODE&gt;
REPORT  z_download_bsis_test.
*Data Declaration
DATA: w_currm TYPE bsis-monat.

SELECT-OPTIONS s_currm FOR w_currm.
"DEFAULT w_currm. " The default value is NOT being populated (appears blank)
"-----------------------------------------------------------------------
"Above DEFAULT addition will not default.
"-----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT.

*   *define current fiscal month
  CALL FUNCTION 'GET_CURRENT_YEAR'
    EXPORTING
      bukrs = 'X999'     " Company Code
      date  = sy-datum   " Date to find fiscal year for
    IMPORTING
      currm = w_currm.   " Current Fiscal Month
  IF w_currm IS INITIAL.
    w_currm = sy-datum+4(2)."I just added for test purpose, you can remove
    "You need to build Select-options table like below.
    s_currm-low = w_currm.
    s_currm-option = 'EQ'.
    s_currm-sign = 'I'.
    APPEND s_currm.
    CLEAR  s_currm.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;
&amp;lt;font color=red&amp;gt;Note:&amp;lt;/font&amp;gt; &lt;STRONG&gt;IF w_currm IS INITIAL&lt;/STRONG&gt; and &lt;STRONG&gt;ENDIF&lt;/STRONG&gt; , I used for testing purpose, you can remove
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Venkat.O on Mar 25, 2010 11:22 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 03:07:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825828#M1470774</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-03-25T03:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Populate SELECT-OPTIONS default value using CALL FUNCTION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825829#M1470775</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 make use the below piece of code.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA:w_currm TYPE bsis-monat.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT-OPTIONS s_currm FOR w_currm .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AT SELECTION-SCREEN OUTPUT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;w_currm = sy-datum+4(2).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;s_currm-low = w_currm.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;s_currm-sign = 'I'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;s_currm-option = 'EQ'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;APPEND s_currm.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Smart Varghese&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 03:53:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825829#M1470775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-25T03:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Populate SELECT-OPTIONS default value using CALL FUNCTION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825830#M1470776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venkat.O,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your clear response.  I have implemented your suggestion and it works, however, I now have a new problem.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each time the report is executed or the "multiple selection" button is clicked the selection fields are populated once again with the default (low) values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, when report is first opened the s_curry field displays '2010'.  Clicking "multiple selection" results in another '2010' being populated.  After executing the report the selection screen is populated again with '2010' (so we now have '2010' listed 3 times in the s_curry field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I prevent the default values from repeating?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  Z_DOWNLOAD_BSIS_TEST


*Data Declaration
DATA:  w_currm TYPE BSIS-MONAT,
       w_curry TYPE BSIS-GJAHR,
       w_prevm TYPE BSIS-MONAT,
       w_prevy TYPE BSIS-GJAHR.


SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE text-001 .

*Parameters to enter the path
PARAMETERS: FILENAME(128) OBLIGATORY DEFAULT '/usr/sap/tmp/TEST.txt'
                         LOWER CASE.

SELECT-OPTIONS: s_curry FOR w_curry,
                s_currm FOR w_currm.

SELECTION-SCREEN END OF BLOCK b11.

AT SELECTION-SCREEN OUTPUT.

*Define current/previous financial periods
CALL FUNCTION 'GET_CURRENT_YEAR'
  EXPORTING
    BUKRS         = 'X999'     " Company Code
    DATE          = SY-DATUM   " Date to find fiscal year for
  IMPORTING
    CURRM         = w_currm    " Current Fiscal Month
    CURRY         = w_curry    " Current Fiscal Year
    PREVM         = w_prevm    " Previous Fiscal Month
    PREVY         = w_prevy.   " Previous Fiscal Year

    s_curry-low = w_curry.
    s_curry-option = 'EQ'.
    s_curry-sign = 'I'.
    APPEND s_curry.
    CLEAR  s_curry.

    s_currm-low = w_currm.
    s_currm-option = 'EQ'.
    s_currm-sign = 'I'.
    APPEND s_currm.
    CLEAR  s_currm.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 04:23:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825830#M1470776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-25T04:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Populate SELECT-OPTIONS default value using CALL FUNCTION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825831#M1470777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi,
&amp;lt;li&amp;gt;You can place the defaulting code under INITIALIZATION event. becuase AT SELECTION-SCREN OUTPUT is triggered for every action done on Selection-screen. 
*Define current/previous financial periods
&lt;PRE&gt;&lt;CODE&gt;"*AT SELECTION-SCREEN OUTPUT. "Comment this event
INITIALIZATION.
"==============
CALL FUNCTION 'GET_CURRENT_YEAR'
  EXPORTING
    BUKRS         = 'X999'     " Company Code
    DATE          = SY-DATUM   " Date to find fiscal year for
  IMPORTING
    CURRM         = w_currm    " Current Fiscal Month
    CURRY         = w_curry    " Current Fiscal Year
    PREVM         = w_prevm    " Previous Fiscal Month
    PREVY         = w_prevy.   " Previous Fiscal Year
 
    s_curry-low = w_curry.
    s_curry-option = 'EQ'.
    s_curry-sign = 'I'.
    APPEND s_curry.
    CLEAR  s_curry.
 
    s_currm-low = w_currm.
    s_currm-option = 'EQ'.
    s_currm-sign = 'I'.
    APPEND s_currm.
    CLEAR  s_currm.&lt;/CODE&gt;&lt;/PRE&gt;
Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 04:57:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populate-select-options-default-value-using-call-function/m-p/6825831#M1470777</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-03-25T04:57:36Z</dc:date>
    </item>
  </channel>
</rss>

