10-03-2008 1:55 PM
Hi All,
I need to get the Row / Column when double click is used in ALV, I can use the double click event for this. However, I do not want to use the Object Oriented ALV. I want to implement the same functionality using general (using functions) ALV.
Is there any way to get the row / column values for a Generia (non-OOPs) ALV report.
Please help.
Thanks,
Vishal.
10-03-2008 2:00 PM
you can do this for normal ALV too.
call function 'REUSE_ALV_GRID_DISPLAY'
.....
I_CALLBACK_USER_COMMAND = 'USER_COMMAND' "important
...
Form user_command using ucomm type sy-ucomm selfield type slis_selfield.
"selfield-fieldname gives you the column name
"selfield-value gives you the value of the column which you clicked
case ucomm.
when '&IC1'.
endcase.
endform.
10-03-2008 2:01 PM
Hello,
The only think you have to do is to get the index where the user clicked, and then read the internal table you sent to the alv
....
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'prg_name'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND' " this is to the click event!!
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = alv_layout
it_fieldcat = alv_fieldcat
i_save = 'A'
it_events = alv_events[]
TABLES
t_outtab = i_totmez. ---> TOUR IT.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
.....
" then....
FORM user_commandUSING r_ucomm TYPE sy-ucomm
ls_selfield TYPE slis_selfield.
" r_ucomm -> HAS THE STATUS
" ls_selfield-tabindex -> HAS THE SELECTED INDEX
" THEN READ THE INTERNAL TABLE
" HERE YOU WILL HAVE THE SELECTED ROW
READ TABLE i_totmez INDEX ls_selfield-tabindex.
ENDFORM.
cheers,
Gabriel P.
10-03-2008 3:05 PM
I am sorry, I missed one point:
I need to display get the values in Blocked ALV List i.e. I have used "REUSE_ALV_BLOCK_LIST_DISPLAY"function module. Here, there is no parameter for passing the "user_command" for 'I_CALLBACK_USER_COMMAND' parameter as it is in 'REUSE_ALV_LIST_DISPLAY'.
I need to get the Row and Column values in Blocked ALV List (withoutusing OOP's).
Thanks,
Vishal.
10-03-2008 3:10 PM
But there is a provision to pass the User Command Subroutine name in the function module REUSE_ALV_BLOCK_LIST_INIT.
Since you are using the BLOCK list, you need to consider the RS_SELFIELD-TABNAME to indentify on which list user interaction was done.
Check report BALVBT01.
Regards,
Naimesh Patel
10-03-2008 2:02 PM
You need to fill the events for the USER_COMMAND.
For the subroutine, do like this:
form f01_alv_event_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
* Here rs_selfield will give you the details of the row and column
endform. " F01_ALV_EVENT_USER_COMMAND
Check report BCALV_TEST_FULLSCREEN_EVENTS.
Regards,
Naimesh Patel
10-03-2008 2:26 PM
Thanks all, I have used the same logic "rs_selfield type slis_selfield" in 'user_command' module.
but the problem is, 'rs_selfield' field is not containing the fieldname or the column value.
I need the column or field name, my report should branch to different transactions even when you are clicking on the same row but different columns.
Thanks,
Vishal.
10-03-2008 2:30 PM
RS_SELFIELD-FIELDNAME will give you the fieldname on which you did the double click (Column)
RS_SELFIELD-TABINDEX will give you the row number.
Regards,
Naimesh Patel
10-03-2008 2:31 PM
Hello,
Yes it does....
check ls_selfield-fieldname....
bye
Gabriel P,.
03-17-2009 2:12 PM