2013 May 13 11:24 PM
Hi experts,
I'm using a grid type cl_gui_alv_grid, and the situation is: the user will select the lines on the grid that he wants to process.
The first column of the grid is the key of the table that i will modify.
My difficulty is on get the value of the first cell of the selected lines.
Someone could help me?
Best regards,
Gustavo
Hi experts,
I'm using a grid type cl_gui_alv_grid, and the situation is: the user will select the lines on the grid that he wants to process.
The first column of the grid is the key of the table that i will modify.
My difficulty is on get the value of the first cell of the selected lines.
Someone could help me?
Best regards,
Gustavo
2013 May 14 7:04 AM
data: LAYOUT TYPE LVC_S_LAYO,
LAYOUT-SEL_MODE = 'D'. /* or 'A'.
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LAYOUT
CHANGING
IT_OUTTAB = GT_OUT[]
IT_FIELDCATALOG = GT_FIELDCAT[].
This provides you the selection box in the ALV output,
Use the method GET_SELECTED_ROWS to process the rows. Write this code in the PAI.
WHEN 'PUSH'
DATA: INDEX_ROWS TYPE LVC_T_ROW,
INDEX LIKE LINE OF INDEX_ROWS.
CLEAR INDEX_ROWS. REFRESH INDEX_ROWS.
CALL METHOD ALV_GRID->GET_SELECTED_ROWS
IMPORTING
ET_INDEX_ROWS = INDEX_ROWS.
LOOP AT INDEX_ROWS INTO INDEX.
* Use the index to read the specific line of ALV which is selected and do the required action
READ TABLE GT_OUT INTO WA_OUT INDEX INDEX-INDEX .
IF SY-SUBRC = 0.
/* do your work with WA_out-keyfield
MODIFY GT_OUT INDEX INDEX-INDEX FROM WA_OUT.
ENDIF.
ENDLOOP.
2013 May 14 7:16 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |