Skip to Content

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

custom container

hi all,

how to capture the field values of the row we have selected from alv grid(custom container).

Tags:
replied

Hi Anil,

Here is a sample code

DATA : itab TYPE STANDARD TABLE OF zzzmaterial,"Output table

i_selected_rows TYPE lvc_t_row,"Selected Rows

w_selected_rows TYPE lvc_s_row,

i_modified TYPE STANDARD TABLE OF zzzmaterial,"For getting modified rows

w_modified TYPE zzzmaterial,

wa TYPE zzzmaterial,

o_docking TYPE REF TO cl_gui_docking_container,"Docking Container

o_grid TYPE REF TO cl_gui_alv_grid."Grid

  • Getting the selected rows index

CALL METHOD o_grid->get_selected_rows

IMPORTING

et_index_rows = i_selected_rows.

  • Through the index capturing the values of selected rows

LOOP AT i_selected_rows INTO w_selected_rows.

READ TABLE itab INTO wa INDEX w_selected_rows-index.

IF sy-subrc EQ 0.

MOVE-CORRESPONDING wa TO w_modified.

APPEND w_modified TO i_modified.

ENDIF.

ENDLOOP.

MODIFY zzzmaterial FROM TABLE i_modified.

Regards

Bala Krishna.

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