03-02-2009 8:42 AM
hello friends,
i have issue when i double click on row in ALV i have to call transaction with that row data.
suppose i double click on 11 then transaction will be called with data of that row.
03-02-2009 8:46 AM
1...
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "#EC *
EXPORTING
i_callback_program = sy-repid
is_layout = is_layout
it_fieldcat = it_fieldcat
i_save = 'A'
i_callback_user_command = 'USERCOMMAND'
TABLES
t_outtab = it_mseg_mat
EXCEPTIONS
program_error = 1
OTHERS = 2.
2...
*&---------------------------------------------------------------------*
*& Form usercommand
*&---------------------------------------------------------------------*
* Handle Double Click on ALV
*----------------------------------------------------------------------*
FORM usercommand USING r_ucomm
ls_selfield TYPE slis_selfield. "#EC CALLED
*&---Looking for Double click on ALV
IF r_ucomm = '&IC1'.
READ TABLE it_mseg_mat ASSIGNING <mseg> INDEX ls_selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BLN' FIELD <mseg>-mblnr.
SET PARAMETER ID 'BUK' FIELD <mseg>-bukrs.
SET PARAMETER ID 'GJR' FIELD <mseg>-mjahr.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM. "usercommand
03-02-2009 8:46 AM
1...
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "#EC *
EXPORTING
i_callback_program = sy-repid
is_layout = is_layout
it_fieldcat = it_fieldcat
i_save = 'A'
i_callback_user_command = 'USERCOMMAND'
TABLES
t_outtab = it_mseg_mat
EXCEPTIONS
program_error = 1
OTHERS = 2.
2...
*&---------------------------------------------------------------------*
*& Form usercommand
*&---------------------------------------------------------------------*
* Handle Double Click on ALV
*----------------------------------------------------------------------*
FORM usercommand USING r_ucomm
ls_selfield TYPE slis_selfield. "#EC CALLED
*&---Looking for Double click on ALV
IF r_ucomm = '&IC1'.
READ TABLE it_mseg_mat ASSIGNING <mseg> INDEX ls_selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BLN' FIELD <mseg>-mblnr.
SET PARAMETER ID 'BUK' FIELD <mseg>-bukrs.
SET PARAMETER ID 'GJR' FIELD <mseg>-mjahr.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM. "usercommand
03-02-2009 9:13 AM
thk for ans ut here problem is that how can i pass selected data to transaction
03-02-2009 9:16 AM
Hi,
Follow steps:-
When you double-click on any cell of alv grid, use this code to fetch the data of the line that you currently clicked, its working:-
When you double click on the ALV grid line, you will have sy-ucomm = '&IC1'.
So when you define a i_callback_user_command for the FM reuse_alv_grid_display, and create it as:-
FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA : ok_code TYPE sy-ucomm.
ok_code = ucomm.
CASE ok_code.
WHEN '&IC1'. "for double click on alv grid line
" your code
ENDCASE.
ENDFORM.
As you have used selfield TYPE slis_selfield, the field selfield will hold all the values.
To know on which row you have clicked and to retain that line, use code:-
Suppose you are currently displaying data from internal table itab and corresponding to it you have work area wa.
read table itab into wa index selfield-tabindex. "index value of line you clicked
" now you have the contents of line that you double clicked currently
Now to know the field name that you clicked, use:-
selfield-fieldname " will fetch you the name of field that you clicked
Now using the work-area and the name of field that you clicked, you can easily make out the details of the field i.e., field name and field value and you can code as per your requirement.
Hope this helps you.
Regards,
Tarun
03-02-2009 9:17 AM
hi,
use set parameters
SET PARAMETER ID: 'AUN' FIELD p_vbeln,
'MAT' FIELD p_matnr
CALL TRANSACTION 'ZCS21' AND SKIP FIRST SCREEN.
03-02-2009 8:47 AM
03-02-2009 8:49 AM
Hi rajan,
In FM - REUSE_ALV_LIST_DISPLAY
U can use
1. I_CALLBACK_USER_COMMAND =
and pass structure name I_STRUCTURE_NAME .
Further select values using select query for that data.
Thanks
Shrila
03-02-2009 8:52 AM
Hi Rajan,
You have to write the logic as
FORM user_command USING
r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'."'ROW'.
IF rs_selfield-fieldname = 'FIELD1'.
READ TABLE it_tab INTO wa_tab INDEX rs_selfield-tabindex.
"Now wa_tab contains the required row
CALL TRANSACTIOn ...
ENDCASE.
ENDFORM.
Regards,
Manoj Kumar P
03-02-2009 9:03 AM
Hi,
Check the below Link
https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action%3fpageid=53583
Hope this helps you.
Regards,
Anki Reddy