‎2006 Dec 20 3:03 PM
Hi all,
I made a simple alv-grid from an internat table.
In one of the columns I have the number of the order (ekpo-ebeln).
What I have to do in order to open the transaction ME5A with a double-click on the field od the number of the order?
‎2006 Dec 20 3:05 PM
Following this example.
report zrich_0001.
* Global ALV Data Declarations
type-pools: slis.
* Internal Tables
data: begin of itab occurs 0,
matnr type mara-matnr,
maktx type makt-maktx,
end of itab.
start-of-selection.
perform get_data.
perform call_alv.
*********************************************************************
* Form GET_DATA
*********************************************************************
form get_data.
select mara~matnr makt~maktx
into corresponding fields of table itab
from mara
inner join makt
on mara~matnr = makt~matnr
up to 20 rows.
endform.
************************************************************************
* CALL_ALV
************************************************************************
form call_alv.
data: ifc type slis_t_fieldcat_alv.
data: xfc type slis_fieldcat_alv.
data: repid type sy-repid.
repid = sy-repid.
clear xfc. refresh ifc.
clear xfc.
xfc-reptext_ddic = 'Material Number'.
xfc-fieldname = 'MATNR'.
xfc-tabname = 'ITAB'.
xfc-outputlen = '18'.
append xfc to ifc.
clear xfc.
xfc-reptext_ddic = 'Material Description'.
xfc-fieldname = 'MAKTX'.
xfc-tabname = 'ITAB'.
xfc-outputlen = '40'.
append xfc to ifc.
* Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = repid
i_callback_user_command = 'HANDLE_USER_COMMAND'
it_fieldcat = ifc
tables
t_outtab = itab.
endform.
***********************************************************************
* FORM handle_User_Command *
***********************************************************************
form handle_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
case rs_selfield-FIELDNAME.
when 'MATNR'.
set parameter id 'MAT' field rs_selfield-value.
call transaction 'MD04' and skip first screen.
endcase.
endcase.
endform.
Regards,
Rich Heilman
‎2006 Dec 20 3:07 PM
1. Function module to display the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
2.. In the USER_COMMAND subroutine FM of ur ALV GRID Display
FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
P_SELFLD TYPE SLIS_SELFIELD.
DATA : L_REP_MODE. "report mode
CASE P_UCOMM.
*when double clicked on ALV grid , report id is passed to transaction
WHEN '&IC1'. "Double click
CALL TRANSACRION 'ME5A'.
ENDCASE.
ENDFORM
‎2006 Dec 20 3:14 PM
And how i can pass the paramenter banfn in order to view immediately the details?
‎2006 Dec 20 3:17 PM
befor using the CALL TRANSACTION statement
SET PARAMETER ID 'BAN' field <ur field value here>.
‎2006 Dec 20 3:31 PM
‎2006 Dec 20 3:32 PM
‎2006 Dec 20 3:08 PM
After ALV print...write
form handle_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
case rs_selfield-FIELDNAME.
when 'MATNR'.
set parameter id 'MAT' field rs_selfield-value.
call transaction 'MD04' and skip first screen.
endcase.
endcase.