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: 

Problem in ALV dipslay

vipulsood
Explorer
0 Kudos

Hi all,

I'm trying to display a simple alv grid using 'set_table_for_first_display' .

Problem is that I'm not able to get the select all options or the option to select multiple rows.

However, if i make my 1st column as editable, then I get it perfectly fine.. I get the option to select multiple rows on left side and also the selectall on top.

How can i get it my not keeping any field editable.

Thanks,

Vipul.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

ls_layout_0223-stylefname = 'CELLSTYLE'.

ls_layout_0223-sel_mode = 'A'. <<<<<<<<<<<<<<<< to select multiple records.

" [ SEL_MODE Set the selection mode (see table below). SPACE, 'A', 'B', 'C', 'D' ]

*-> Calls ALV

CALL METHOD gir_alvgrid_plnast_evt->set_table_for_first_display

EXPORTING

it_toolbar_excluding = lt_exclude_toolbar

is_layout = ls_layout_0223 <<<<<<<<<<<<< pass the layout here

CHANGING

it_outtab = gt_plnast_outtab

it_fieldcatalog = lt_fieldcat_0223

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

I don''t know if I got ur issue.

just try in case it works.

Thanks.

PM

5 REPLIES 5

Former Member
0 Kudos

That's the way it is done!

But one step missing... after:


call method grid->set_table_for_first_display(  ).

you should do:


CALL METHOD grid->set_ready_for_input 
EXPORTING 
i_ready_for_input = 0.

This way your grid wont be able to edit, even if your field catalog has edit = 'X'.. And you can select several rows

0 Kudos

I tried as you had metioned. But doesn't work.

still I'm not able to get that multi slection and select all option. In fact few other buttons like 'refresh' are also not visible.

Former Member
0 Kudos

Hi ,

You can view this example, i suppose this will solve ur problem:

REPORT ZTEST_DIL4 .
TABLES ZMSTKSUM.
DATA : OK_CODE LIKE SY-UCOMM,
       TAB_DISPLAY TYPE TABLE OF ZMSTKSUM,
       C_CONTAINER TYPE SCRFNAME VALUE 'DILEEP_TEST1',
       ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
       C_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_WERKS FOR ZMSTKSUM-WERKS.
SELECTION-SCREEN END OF BLOCK B1.
SELECT * FROM ZMSTKSUM INTO TABLE TAB_DISPLAY WHERE WERKS IN S_WERKS.
CALL SCREEN 100.
*&---------------------------------------------------------------------
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN'.
*  SET TITLEBAR 'xxx'.
  IF C_CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT C_CUSTOM_CONTAINER EXPORTING CONTAINER_NAME = C_CONTAINER.
    CREATE OBJECT ALV_GRID EXPORTING I_PARENT = C_CUSTOM_CONTAINER.
    CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
  I_STRUCTURE_NAME              = 'ZMSTKSUM'
      CHANGING
        IT_OUTTAB                     = TAB_DISPLAY.
    IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------
MODULE USER_COMMAND_0100 INPUT.
  CASE OK_CODE.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

For ur knowledge, visit these links. it helps a lot to you:

1. http://www.erpgenie.com/sap/abap/controls/alvgrid.htm

2. http://help.sap.com/saphelp_wp/helpdata/en/0a/b5533cd30911d2b467006094192fe3/content.htm

Regards.

Deepak

raymond_giuseppi
Active Contributor
0 Kudos

In the IS_LAYOUT parameter of [set_table_for_first_display|http://help.sap.com/saphelp_bw/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm] did you set field SEL_MODE (and BOX_FNAME)

(Check [The Layout Structure|http://help.sap.com/saphelp_bw/helpdata/en/ef/a2e9e9f88311d2b48d006094192fe3/frameset.htm] and [Properties of the ALV Grid Control|http://help.sap.com/saphelp_bw/helpdata/en/ef/a2e9eff88311d2b48d006094192fe3/frameset.htm])

Regards,

Raymond

Former Member
0 Kudos

Hi,

ls_layout_0223-stylefname = 'CELLSTYLE'.

ls_layout_0223-sel_mode = 'A'. <<<<<<<<<<<<<<<< to select multiple records.

" [ SEL_MODE Set the selection mode (see table below). SPACE, 'A', 'B', 'C', 'D' ]

*-> Calls ALV

CALL METHOD gir_alvgrid_plnast_evt->set_table_for_first_display

EXPORTING

it_toolbar_excluding = lt_exclude_toolbar

is_layout = ls_layout_0223 <<<<<<<<<<<<< pass the layout here

CHANGING

it_outtab = gt_plnast_outtab

it_fieldcatalog = lt_fieldcat_0223

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

I don''t know if I got ur issue.

just try in case it works.

Thanks.

PM