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: 

OO ALV , sort order screen missing save icon

Former Member
0 Kudos

Hello all,

The following code creates an ALV on a selection screen, 1001. When the ALV is displayed and the sort order screen is presented, the save icon is missing. Does anyone know why?

Thanks

Bruce

 
INCLUDE rsdbc1xx.      " selection screen stuff
DATA: l_alv      TYPE REF TO   cl_gui_alv_grid,
      lt_sflight TYPE TABLE OF sflight.

DATA: lt_exclude  TYPE STANDARD TABLE OF syucomm.
PARAMETERS: p_nuthin AS CHECKBOX.

SELECTION-SCREEN BEGIN OF SCREEN 1001.
SELECTION-SCREEN END   OF SCREEN 1001.
 * events at selection-screen output.
 *
AT SELECTION-SCREEN OUTPUT.
*
  IF sy-dynnr = '1001'.
    current_scr-mode = 'S'.
*                                        disable functions:
    APPEND 'SPOS' TO current_scr-excl.
    APPEND 'SCRH' TO current_scr-excl.
    APPEND 'ONLI' TO current_scr-excl.    "Online execution
*    APPEND 'PRIN' TO current_scr-excl.   "Execute and print
  ENDIF.
*
 *  IF sy-tcode EQ 'ZZREPORT'. " Replace with your own transaction code
*

*
START-OF-SELECTION.
*
  SELECT * FROM sflight INTO TABLE lt_sflight.
* Creation of the ALV object, when we use cl_gui_container=>screen0 as
* parent, the ALVGrid control will automatically use the full screen to
* display the grid, NO CONTAINER DEFINITION IS REQUIRED !
*
  CREATE OBJECT l_alv EXPORTING i_parent = cl_gui_container=>screen0.
*
*  Set layout options:
 data: w_LVC_S_LAYO type LVC_S_LAYO.
*
  w_LVC_S_LAYO-zebra      = 'X'.
  w_LVC_S_LAYO-sel_mode   = 'D' .             "  D = cell selection
  w_LVC_S_LAYO-GRID_TITLE =
     'Grid title - 60 characters maximum'.
*
* calling the display of the grid, the system will automatically create
* the fieldcatalog based on the table name you pass in parameter
*
  CALL METHOD l_alv->set_table_for_first_display
    EXPORTING
      i_bypassing_buffer = 'X'
      is_layout          = w_LVC_S_LAYO
      i_structure_name   = 'SFLIGHT'
    CHANGING
      it_outtab          = lt_sflight.
*
*
* You have to create an EMPTY screen, put NOTHING in the layout and
* this is going to work
    CALL SELECTION-SCREEN 1001.

Edited by: Bruce Tjosvold on Sep 9, 2009 1:20 PM

Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code. I removed some unneeded comments

Edited by: Rob Burbank on Sep 9, 2009 1:30 PM

2 REPLIES 2

Sandra_Rossi
Active Contributor
0 Kudos

you must use these parameters (and at least I_SAVE) of SET_TABLE_FOR_FIRST_DISPLAY method:


IS_VARIANT            = <structure of type DISVARIANT>
I_SAVE                = <var. of type CHAR01>

this is an excerpt of sap library, and you may find many discussions about that.

0 Kudos

Sandra,

Your reply put me on the path to a solution.

Thanks

Bruce

FYI, for others that may be interested, this is the code that allowed me to see the save icon when the change layout screen was displayed.

.
Data: w_is_variant type DISVARIANT.
*
w_is_variant-REPORT = sy-cprog.
*
* calling the display of the grid, the system will automatically create
* the fieldcatalog based on the table name you pass in parameter
*
  CALL METHOD l_alv->set_table_for_first_display
    EXPORTING
      i_bypassing_buffer = 'X'
      is_layout          = w_LVC_S_LAYO
      IS_VARIANT    = w_is_variant
      I_SAVE             = 'A'
      i_structure_name   = 'SFLIGHT'
    CHANGING
      it_outtab          = lt_sflight.

.

Edited by: Bruce Tjosvold on Sep 9, 2009 6:58 PM