<?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: selection parameter empty in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771538#M907504</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;Please refer the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS: sp_vari LIKE disvariant-variant.        "Dispaly Variant

* Data for ALV variant
DATA  gv_repname          LIKE sy-repid.
DATA  gv_x_variant        LIKE disvariant.
DATA  gv_exit(1)          TYPE c.
DATA  gv_save(1)          TYPE c.
DATA  gv_variant          LIKE disvariant.

INITIALIZATION.

  PERFORM f_initialize_variant.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR sp_vari.
  PERFORM f_f4_for_variant.

AT SELECTION-SCREEN.

*  Validating selection screen fields
  PERFORM f_at_selection_screen.


FORM f_initialize_variant .

  CLEAR gv_variant.
  gv_save           = 'X'.
  gv_variant-report = gv_repname.
  gv_x_variant      = gv_variant.

  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = gv_save
    CHANGING
      cs_variant = gv_x_variant
    EXCEPTIONS
      not_found  = 2.

  IF sy-subrc = 0.

    sp_vari = gv_x_variant-variant.

  ENDIF.

ENDFORM.                    " f_initialize_variant

FORM f_f4_for_variant .
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = gv_variant
      i_save     = gv_save
    IMPORTING
      e_exit     = gv_exit
      es_variant = gv_x_variant
    EXCEPTIONS
      not_found  = 2.

  IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    IF gv_exit = space.
      sp_vari = gv_x_variant-variant.
    ENDIF.
  ENDIF.

ENDFORM.                    " f_f4_for_variant

FORM f_at_selection_screen .

* ALV Layout variant
  IF NOT sp_vari IS INITIAL.

    MOVE gv_variant TO gv_x_variant.
    MOVE sp_vari    TO gv_x_variant-variant.

    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        i_save     = gv_save
      CHANGING
        cs_variant = gv_x_variant.
    gv_variant = gv_x_variant.

  ELSE.

    PERFORM f_initialize_variant.

  ENDIF.

ENDFORM.                    " f_at_selection_screen
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And pass 'A' to I_SAVE export parameters of ALV FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Apr 2008 10:06:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-29T10:06:09Z</dc:date>
    <item>
      <title>selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771535#M907501</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;I have the following situation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have in the report a selection parameter for layout. It is totally empty.&lt;/P&gt;&lt;P&gt;On my ALV output there is  BUTTON select buuton. I can select here&lt;/P&gt;&lt;P&gt;some layouts wihich I have saved privously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But why is the selection parameter empty ?&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;ertas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECTION-SCREEN SKIP.
PARAMETERS: pa_lv TYPE disvariant-variant.

wa_variant-report = sy-cprog.
  IF NOT pa_lv IS INITIAL.
    wa_variant-variant = pa_lv.
    save = 'A'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD gr_alv-&amp;gt;set_table_for_first_display
       EXPORTING
         i_structure_name              = 'ZITAB
         is_variant                    = wa_variant
         i_save                        = save
         i_default                     =  'X'
         is_layout                     = wa_layout
      CHANGING
        it_outtab                     =  it_li
        it_fieldcatalog               =  it_fcat

       EXCEPTIONS

         OTHERS                        = 4&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 09:56:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771535#M907501</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T09:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771536#M907502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;default the selection parameter or assign some value in&lt;/P&gt;&lt;P&gt;initialization...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 10:01:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771536#M907502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T10:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771537#M907503</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 have to populate the parameter value in the selection screen when executing the report. If you want to provide F4 help with the saved layouts add the below code in the report. when executing the report, if you click on F4 for that parameter you will be able to see the variant you have saved. You can choose that variant and run your ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_LV.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            IS_VARIANT = G_VARIANT&lt;/P&gt;&lt;P&gt;            I_SAVE     = G_SAVE&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            E_EXIT     = G_EXIT&lt;/P&gt;&lt;P&gt;            ES_VARIANT = GX_VARIANT&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            NOT_FOUND  = 2.&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 2.&lt;/P&gt;&lt;P&gt;    MESSAGE ID SY-MSGID TYPE 'S'      NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    IF G_EXIT = SPACE.&lt;/P&gt;&lt;P&gt;      PA_LV = GX_VARIANT-VARIANT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Lakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 10:04:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771537#M907503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T10:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771538#M907504</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;Please refer the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS: sp_vari LIKE disvariant-variant.        "Dispaly Variant

* Data for ALV variant
DATA  gv_repname          LIKE sy-repid.
DATA  gv_x_variant        LIKE disvariant.
DATA  gv_exit(1)          TYPE c.
DATA  gv_save(1)          TYPE c.
DATA  gv_variant          LIKE disvariant.

INITIALIZATION.

  PERFORM f_initialize_variant.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR sp_vari.
  PERFORM f_f4_for_variant.

AT SELECTION-SCREEN.

*  Validating selection screen fields
  PERFORM f_at_selection_screen.


FORM f_initialize_variant .

  CLEAR gv_variant.
  gv_save           = 'X'.
  gv_variant-report = gv_repname.
  gv_x_variant      = gv_variant.

  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = gv_save
    CHANGING
      cs_variant = gv_x_variant
    EXCEPTIONS
      not_found  = 2.

  IF sy-subrc = 0.

    sp_vari = gv_x_variant-variant.

  ENDIF.

ENDFORM.                    " f_initialize_variant

FORM f_f4_for_variant .
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = gv_variant
      i_save     = gv_save
    IMPORTING
      e_exit     = gv_exit
      es_variant = gv_x_variant
    EXCEPTIONS
      not_found  = 2.

  IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    IF gv_exit = space.
      sp_vari = gv_x_variant-variant.
    ENDIF.
  ENDIF.

ENDFORM.                    " f_f4_for_variant

FORM f_at_selection_screen .

* ALV Layout variant
  IF NOT sp_vari IS INITIAL.

    MOVE gv_variant TO gv_x_variant.
    MOVE sp_vari    TO gv_x_variant-variant.

    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        i_save     = gv_save
      CHANGING
        cs_variant = gv_x_variant.
    gv_variant = gv_x_variant.

  ELSE.

    PERFORM f_initialize_variant.

  ENDIF.

ENDFORM.                    " f_at_selection_screen
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And pass 'A' to I_SAVE export parameters of ALV FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 10:06:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771538#M907504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T10:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771539#M907505</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;Try out the following code enhancing your exitsing code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; wa_variant-report = sy-cprog.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if no variant is selected, put a default variant&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some default variants include(1SAP,1STANDARD)&lt;/P&gt;&lt;P&gt;try passing them directly in your code above instead of p_var&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT pa_lv IS INITIAL.&lt;/P&gt;&lt;P&gt;Call the FM : REUSE_ALV_VARIANT_F4&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 10:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771539#M907505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T10:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771540#M907506</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;&lt;/P&gt;&lt;P&gt;I get the message  "No Layou found"&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if I klick F4 in the selection screen .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why ?&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;ilhan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 10:26:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771540#M907506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T10:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771541#M907507</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 need to execute the report and choose the columns and save the layout. Go back to the selection screen and press F4. You can see the saved layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 10:45:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771541#M907507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T10:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771542#M907508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sriram this exactly the problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have saved some layouts in my output (ALV). I can't see them when I press F4 at the selection screen.&lt;/P&gt;&lt;P&gt;I always get the message "No Layout found".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;ilhan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 10:54:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771542#M907508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T10:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: selection parameter empty</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771543#M907509</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;Please refer the sample ALV FM. Make sure that to pass 'A' to I_SAVE  export parameter.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    CALL METHOD go_grid1-&amp;gt;set_table_for_first_display
      EXPORTING
        is_layout       = gs_layout
        is_print        = gs_print
        is_variant      = gs_variant                      
        i_save          = gv_save                           
        i_default       = gv_default                        
      CHANGING
        it_outtab       = gt_item_data
        it_fieldcatalog = gt_field_catalog.            .
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sriram Ponna on Apr 29, 2008 4:43 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2008 11:12:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-parameter-empty/m-p/3771543#M907509</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-29T11:12:32Z</dc:date>
    </item>
  </channel>
</rss>

