Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with Mulitple Line Selection in ALV

Hi folks,

As suggested on many questions i have declared a field "SEL" in the final Table of ALV,made it a check Box,Passed the value in wa_layout-box_field name and handled it in 'USER_COMMAND' but the problem is that SEL is always initial. After having selected some lines, there is no X in SEL Field.

Do I need to any more steps for the  field "SEL" is filled?

Here is the code/steps i have done for multiple line selection.

1)BEGIN OF ty_final,
sel TYPE c,
kante TYPE  kante ,
       END OF ty_final,

2)  wa_layout   TYPE slis_layout_alv,

   wa_layout-box_fieldname     = 'SEL'.
   wa_layout-edit_mode = 'A'.
   wa_layout-box_tabname = 'LI_FINAL'.
   wa_layout-colwidth_optimize = 'X'.

3)*Adding check box in the 1st Coloumn.
   wa_fieldcat-fieldname = 'SEL' .
   wa_fieldcat-seltext_l = 'Select' .
   wa_fieldcat-checkbox = 'X'.
   wa_fieldcat-edit = 'X'.
   APPEND wa_fieldcat TO it_fieldcat .
   CLEAR : wa_fieldcat.

4)CLEAR wa_events.
   wa_events-name              = 'USER_COMMAND'.
   wa_events-form              = 'USER_COMMAND'.
   APPEND wa_events TO it_events.

   CLEAR wa_events.
     EXPORTING  i_callback_program  = g_repid
                i_callback_pf_status_set = 'MY_STATUS'
*               i_callback_user_command = 'USER_COMMAND'
                is_layout     = wa_layout
                it_fieldcat   = it_fieldcat
                it_events          = it_events
     TABLES     t_outtab      = li_final
     EXCEPTIONS program_error = 1
                OTHERS        = 2.

*&      Form  USER_COMMAND
FORM user_command USING ucomm LIKE sy-ucomm
                         selfield TYPE slis_selfield.

* Check function code
   CASE ucomm.

     WHEN 'CR' OR 'DC'."create Commissioning Work Order or
       "create De-Commissioning Work Order

*     Choosing entries which are selected in ALV
       LOOP AT li_final INTO wa_final WHERE sel = 'X'.
         wa_final1-eqnach = wa_final-eqnach.
         wa_final1-eqvon  = wa_final-eqvon.
         APPEND wa_final1 TO li_final1.



Hi Abhishek ,

Please try the below code :

DATA ls_ref1 TYPE REF TO cl_gui_alv_grid . " Ref to ur grid



e_grid = ls_ref1.

CALL METHOD ls_ref1->check_changed_data . " gets the changes data

Now will get selected records in the itab. You can process the itab with value 'X'

Thanks & Regards -


1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question