05-21-2009 6:55 AM
Hi,
Im trying to call transcation ME51N from my module pool program.Im using the following code
Set parametre id :'MAT' field matnr.
call transcation 'ME51N'.
but the material is not displaying in ME51n
Please help solve the issue
05-21-2009 7:07 AM
05-21-2009 7:23 AM
I have a Z tocde where i have material and qty coloumn.when i click on the check box for a particular material i need the screen to Call ME51N with that particular material in the line item of ME51N.
05-21-2009 7:29 AM
use USING ITAB feature of CALL TRANSACTION....
pass material value in ITAB...
05-21-2009 7:34 AM
Hi,
try this code,
report: ztest.
TYPE-POOLS : SLIS.
data : field type slis_fieldcat_alv,
fieldcat type slis_t_fieldcat_alv.
data : layout type slis_layout_alv,
lay type slis_layout_alv_spec1.
data : heading TYPE slis_t_listheader,
SM_EVENT TYPE SLIS_T_EVENT,
WA_SM_EVENT TYPE SLIS_ALV_EVENT.
data : begin of itab occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
matkl like mara-matkl,
end of itab.
data : field1(30).
selection-screen : function key 1,
function key 2.
initialization .
a1 = 'Selection-Screen'.
sscrfields-functxt_01 = text-001.
sscrfields-functxt_02 = text-002.
at selection-screen.
case SSCRFIELDS-UCOMM.
when 'FC01'.
leave program.
when 'FC02'.
* leave to transaction 'ME51N'.
call transaction 'ME51N.
endcase.
start-of-selection.
select a~matnr a~matkl b~maktx into corresponding fields of itab
from mara as a join makt as b on a~matnr = b~matnr
where a~matnr in matnr and a~matkl in matkl.
append itab.
endselect.
layout-zebra = 'X'.
layout-colwidth_optimize = 'X'.
layout-detail_popup = 'X'.
*layout-CONFIRMATION_PROMPT = 'X'.
layout-COLWIDTH_OPTIMIZE = 'X'.
layout-no_input = 'X'.
CLEAR WA_SM_EVENT.
WA_SM_EVENT-NAME = 'TOP_OF_LIST'.
WA_SM_EVENT-FORM = 'TOP_OF_LIST'.
APPEND WA_SM_EVENT TO SM_EVENT.
field-col_pos = '0'.
field-fieldname = 'MATNR'.
field-seltext_l = 'Material No'.
field-outputlen = '18'.
field-key = 'X'.
field-hotspot = 'X'.
append field to fieldcat.
clear field.
field-col_pos = '1'.
field-fieldname = 'MAKTX'.
field-seltext_l = 'Material Desc'.
field-outputlen = '40'.
append field to fieldcat.
clear field.
field-col_pos = '2'.
field-fieldname = 'MATKL'.
field-seltext_l = 'Material Grp'.
field-outputlen = '40'.
append field to fieldcat.
clear field.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'PICK'
* I_STRUCTURE_NAME =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
* IS_VARIANT =
IT_EVENTS = SM_EVENT
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM PICK USING COMMAND LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
READ TABLE ITAB INDEX SELFIELD-TABINDEX.
CASE COMMAND.
WHEN '&IC1'.
GET CURSOR FIELD field1.
CHECK field1 EQ 'ITAB-MATNR'.
SET PARAMETER ID 'MAT' FIELD ITAB-MATNR.
CALL TRANSACTION 'ME51N' AND SKIP FIRST SCREEN.
ENDCASE .
Regards,
Nikhil.
Edited by: Nikhil Kanegaonkar on May 27, 2009 10:57 AM
05-21-2009 7:39 AM
hi,
if you have material and quantity column in alv then either u need to catch the click event and call the transaction me51n under that event or u need to provide any button and call transaction at the function code of that button.
my point is you have called transaction under some event or not ?
regards
vj
05-21-2009 9:51 AM
Hi,
You have to use some events like sy-ucomm inorder to call the transaction.
1. you have to capture the value of matnr in a workarea field or in a variable.
2. use hide statement inorder to capture the matnr. eg: HIDE v_matnr.
3. you have to capture the sy-ucomm code while debugging.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'ABC'.
SET PARAMETER ID 'MAT' FIELD v_matnr.
CALL TRANSACTION 'ME51N'.
END CASE.
Thanks,
Mohanraj.N
05-25-2009 12:52 PM
Mohanraj.N's answer is enough for this problem.
And I met a scenario where I had to define an internal table to hold the ID value.