‎2007 Jan 17 5:32 PM
Hi all,
i have a modulepool program custom made and an upload program.
I am calling the modulepool program from my upload program.
i have several info mesages in my module for any user errors.
say if i have an error in the excel sheet that iam uploading to the same transaction, i want to get the same info mess in to
loop at itab.
perform bdc_dynpro using 'SAPMZTEST' '9002'.
perform bdc_field using 'BDC_OKCODE'
'=ZNEW'.
perform bdc_field using 'BDC_CURSOR'
'%#AUTOTEXT001'.
perform bdc_dynpro using 'SAPMZTEST' '9003'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'BDC_CURSOR'
'ZTEST-KOSTL(01)'.
perform bdc_field using 'ZTEST-ERDAT(01)'
itab-erdat.
perform bdc_field using 'ZTEST-MATNR(01)'
itab-matnr.
perform bdc_field using 'ZTEST-MENGE(01)'
itab-menge.
perform bdc_field using 'ZTEST-KOSTL(01)'
itab-kostl.
perform bdc_dynpro using 'SAPMZTEST' '9003'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'BDC_CURSOR'
'%#AUTOTEXT001'.
call transaction 'ZTCODE' using i_bdcdata
mode 'A'
messages into i_bdcmsgcoll.
refresh i_bdcdata.
call function 'FORMAT_MESSAGE'
exporting
id = sy-msgid
lang = '-D'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
importing
msg = zmsg1
exceptions
not_found = 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.
i_error1-matnr = itab-matnr.
i_error1-text = zmsg1.
if i_error1-text is initial.
i_error1-text = 'Order Placed'.
else.
text1 = 'Order Not Placed'.
endif.
write : / i_error1-matnr , 20 i_error1-text , 80 text1.
clear text1.
clear zmsg1.
append i_error1.
clear i_error1.
endloop.
I WANT THE INFO MESS IN ZMSG1
CAN ANYONE TELL ME HOW TO ACHIEVE THIS
Thanks
‎2007 Jan 17 5:36 PM
‎2007 Jan 17 5:36 PM
‎2007 Jan 17 5:38 PM
Hi,
After this code
call transaction 'ZTCODE' using i_bdcdata
mode 'A'
messages into i_bdcmsgcoll.
refresh i_bdcdata.You need loop through the internal table or read the internal table <b>i_bdcmsgcoll</b> and write the code.
call transaction 'ZTCODE' using i_bdcdata
mode 'A'
messages into i_bdcmsgcoll.
refresh i_bdcdata.
<b>loop at/read table i_bdcmsgcoll</b>
call function 'FORMAT_MESSAGE'
exporting
id = sy-msgid
lang = '-D'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
importing
msg = zmsg1
exceptions
not_found = 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.
i_error1-matnr = itab-matnr.
i_error1-text = zmsg1.
if i_error1-text is initial.
i_error1-text = 'Order Placed'.
else.
text1 = 'Order Not Placed'.
endif.
write : / i_error1-matnr , 20 i_error1-text , 80 text1.
clear text1.
clear zmsg1.
append i_error1.
clear i_error1.
endloop.
‎2007 Jan 17 5:39 PM
Hi,
<b>Loop at i_bdcmsgcoll where mestype = 'E'.</b>
call function 'FORMAT_MESSAGE'
exporting
id = sy-msgid
lang = '-D'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
importing
msg = zmsg1
exceptions
not_found = 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.
<b>endloop.</b>
Keep the above code outside the present loop.
‎2007 Jan 17 6:13 PM
Hi all,
i have changed my code as
LOOP AT I_BDCMSGCOLL.
call function 'FORMAT_MESSAGE'
exporting
id = sy-msgid
lang = '-D'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
importing
msg = zmsg1
exceptions
not_found = 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.
ENDLOOP.
The mess type is 'S'.
IN THE module pool the message is
MATERIAL DOESN'T BELONG TO PLANT
WHERE AS IN MY
zmsg1
I AM GETTING THE No batch input data for screen SAPMSSY3 0131
THIS IS WHAT I HAVE IN i_bdcmsgcoll[1]
TCODE C 20 ZTEST
DYNAME C 40 SAPMSSY3
DYNUMB C 4 0131
MSGTYP C 1 S
MSGSPRA C 1 E
MSGID C 20 00
MSGNR C 3 344
MSGV1 C 100 SAPMSSY3
MSGV2 C 100 0131
MSGV3 C 100
MSGV4 C 100
ENV C 4 CTU
FLDNAME C 132
canyone tell mw to where i'm missing the trick
Thanks