07-22-2010 8:18 AM
Hi.
When I double click one record on the ALV grid, the parameter 'rs_selfield-tabindex' doesn't return the index in my output table.
It seems that rs_selfield-tabindex returns the rowno as displayed and not the corresponding rowno of my output table. Resulting in wrong values after the grid is sorted.
How can I determine the row in my table from the selected cell in the grid?
07-22-2010 8:30 AM
Hi,
rs_selfield-tabindex returns the row no on which u have double clicked. after geting tt rs_selfield-tabindex u have to read the o/p table with tat index = rs_selfield-tabindex. you will get the whole record
07-22-2010 8:39 AM
HI, Shetty.
Can you tell me what's name of o/p table? my output table name is it_data.
07-22-2010 9:25 AM
Hi,
Do the things like this way:
READ TABLE IT_DATA INTO WA_DATA INDEX RS_SELFIELD-TABINDEX. "This gives you the record for that selected row
I am providing one example for your help:
*SET PF-STATUS 'YSTATUS'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = gs_layout
i_buffer_active = 'X'
it_fieldcat = ct_fieldcat[]
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_DEFAULT = 'X'
I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'
i_save = 'A'
TABLES
t_outtab = lt_purchase[].
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
FORM HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'MATNR'.
CLEAR : wa_purchase.
READ TABLE lt_purchase INTO wa_purchase INDEX RS_SELFIELD-TABINDEX.
if wa_purchase-matnr is NOT INITIAL.
SET PARAMETER ID: 'MAT' FIELD wa_purchase-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
endif.
endform
May it helps you.
Regards.
DS
07-22-2010 1:08 PM
07-23-2010 3:47 AM
sovled,
1. the internal table must be gobal variant.
2. the code 'read table index tabindex' must in subroutine 'user_command'.