* ALV aufrufen
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'CALLBACK_USER_COMMAND'
it_fieldcat_lvc = gt_fcat
TABLES
t_outtab = gt_data
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Ereignishandler
FORM callback_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
FIELD-SYMBOLS <ls_data> TYPE t_data.
IF r_ucomm = '&IC1'. "Hotspot wurde geklickt
CASE rs_selfield-fieldname.
WHEN 'CHECK1'.
READ TABLE gt_data ASSIGNING <ls_data> INDEX rs_selfield-tabindex.
IF sy-subrc = 0. "Klicks auf Summenzeile abfangen!
IF <ls_data>-check1 = space.
<ls_data>-check1 = 'X'.
<ls_data>-check2 = space.
ELSE.
<ls_data>-check1 = space.
<ls_data>-check2 = 'X'.
ENDIF.
rs_selfield-refresh = 'X'. "Neue Werte ans Frontend übertragen
rs_selfield-col_stable = 'X'. "Scollposition beibehalten
rs_selfield-row_stable = 'X'. "Scollposition beibehalten
ENDIF.
WHEN 'CHECK2'.
READ TABLE gt_data ASSIGNING <ls_data> INDEX rs_selfield-tabindex.
IF sy-subrc = 0. "Klicks auf Summenzeile abfangen!
IF <ls_data>-check2 = space.
<ls_data>-check2 = 'X'.
<ls_data>-check1 = space.
ELSE.
<ls_data>-check2 = space.
<ls_data>-check1 = 'X'.
ENDIF.
rs_selfield-refresh = 'X'. "Neue Werte ans Frontend übertragen
rs_selfield-col_stable = 'X'. "Scollposition beibehalten
rs_selfield-row_stable = 'X'. "Scollposition beibehalten
ENDIF.
WHEN OTHERS.
"es wurde eine andere Spalte ausgewählt, also nichts tun
ENDCASE.
ENDIF.
ENDFORM. "callback_user_command
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com
Social Plugin