2006 Mar 29 5:43 AM
Hi All,
I have written a BDC pgm. While executing it in 'A' mode
a worning message comes, bcos of which the pop-up which shows OK code in BDC disappeares and pgm stops at that screen.
any idea how to capture these messages in BDC?
Regards
Saurabh.
2006 Mar 29 5:47 AM
Here error messages would be in MESSTAB
<b> CALL TRANSACTION TCODE USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.</b>
2006 Mar 29 5:47 AM
Here error messages would be in MESSTAB
<b> CALL TRANSACTION TCODE USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.</b>
2006 Mar 29 5:51 AM
Hi Wenceslaus,
No. The problem is even if that warning message comes up i dont want the OK code pop up 2 disappear as I m executing the pgm in A(Display screen) Mode.
Regards
Saurabh.
2006 Mar 29 6:08 AM
Hi Saurabh,
If you run in A (Display All Screens) Mode you will get all these OK code instead run in N(Background) or E(Errors Only) Mode. Then you will not get those OK codes.
After the call transaction you will get the error msg in messtab. You can get the error messages there.
Regards,
Wenceslaus.
2006 Mar 29 6:08 AM
i m pretty sure that you want to run the program in the 'A' mode only for your testing purpose....once you run it in N or E mode then you will not have such a problem....
in case you get a warning message in the A mode, either type the OK code manually (of course you need to know it in such a case) ....or just press Enter once....it worked for me ...the next OK code value in the BDCDATA table appeared in the popup....
as already indicated in earlier replies, the messages in N or S mode are captured using the BDCMSGCOLL structure with the MESSAGES INTO addition....
2006 Mar 29 5:47 AM
DATA : BEGIN OF T_UPLOAD OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
PLANT LIKE RMMG1-WERKS,
END OF T_UPLOAD.
DATA : BEGIN OF T_DOWNLOAD OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
PLANT LIKE RMMG1-WERKS,
MSG(200),
END OF T_DOWNLOAD.
DATA : T_BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
DATA : WA_BDCMSGCOLL TYPE BDCMSGCOLL.
DATA : ERR_LOG TYPE MESSAGE.
Set the parameters for Call Transaction
CLEAR WA_CTU_PARAMS.
WA_CTU_PARAMS-DISMODE = 'N'.
WA_CTU_PARAMS-UPDMODE = 'S'.
WA_CTU_PARAMS-NOBINPT = 'X'.
WA_CTU_PARAMS-NOBIEND = 'X'.
WA_CTU_PARAMS-DEFSIZE = 'X'.
Call Transaction MM01
IF W_FLAG NE 'X'.
<b>CALL TRANSACTION 'MM01' USING T_BDCDATA OPTIONS FROM WA_CTU_PARAMS
MESSAGES INTO T_BDCMSGCOLL.
COMMIT WORK AND WAIT.</b>
DESCRIBE TABLE T_BDCMSGCOLL LINES N.
IF N <> 0.
LOOP AT T_BDCMSGCOLL INTO WA_BDCMSGCOLL.
CLEAR ERR_LOG.
W_MSGNO = WA_BDCMSGCOLL-MSGNR.
CALL FUNCTION <b>'WRITE_MESSAGE'</b> EXPORTING
MSGID = WA_BDCMSGCOLL-MSGID
MSGNO = W_MSGNO
MSGTY = WA_BDCMSGCOLL-MSGTYP
IMPORTING
MESSG = ERR_LOG.
Error that occurs during transactoon
IF ERR_LOG-MSGTY = 'E'.
MOVE-CORRESPONDING T_UPLOAD TO T_DOWNLOAD.
MOVE ERR_LOG-MSGTX TO T_DOWNLOAD-MSG.
APPEND T_DOWNLOAD.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
regards
vinod
2006 Mar 29 5:49 AM
Hi !
Try the N or E Mode of BDC.
Warings (and S , I ) messages are ignores by the system im this modes so your BDC should continue...
Regards
Rainer
2006 Mar 29 5:51 AM
*Internal table to store messages from Call Transaction.
DATA : I_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL WITH HEADER LINE.
*Internal table for BDC data
I_BDCTAB TYPE BDCDATA OCCURS 0 WITH HEADER LINE,
V_MODE(1) TYPE C VALUE 'A', " Call Transaction mode
v_update(1) value 'S'.
CALL TRANSACTION V_TCODE USING I_BDCTAB
MODE V_MODE
UPDATE V_UPDATE
MESSAGES INTO I_BDCMSGCOLL.
mesages will be captured in I_BDCMSGCOLL.
2006 Mar 29 5:54 AM
Hi Saurabh,
You can code something like this.
data: i_msgtab like bdcmsgcoll occurs 0 with header line.
clear i_msgtab.
refresh i_msgtab.
call transaction 'VF02' using bdcdata
mode p_mode
update 'S'
messages into i_msgtab.
if sy-subrc <> 0.
*Process and display error messages
loop at i_msgtab.
clear t100.
select single * from t100
whree sprsl = i_msgtab-msgspra and
arbgb = i_msgtab-msgid and
msgnr = i_msgtab-msgnr.
perform process_message using t100-text.
endloop.
endif.
*&---------------------------------------------------------------------*
*& Form process_message
*&---------------------------------------------------------------------*
* Process and display error message into control status report
*----------------------------------------------------------------------*
* -->P_MESSAGE Message text
*----------------------------------------------------------------------*
form process_message using p_message.
data: l_message(480).
if sy-subrc = 0.
l_message = p_message.
if l_message cs '&1'.
replace '&1' with i_msgtab-msgv1 into l_message.
replace '&2' with i_msgtab-msgv2 into l_message.
replace '&3' with i_msgtab-msgv3 into l_message.
replace '&4' with i_msgtab-msgv4 into l_message.
else.
replace '&' with i_msgtab-msgv1 into l_message.
replace '&' with i_msgtab-msgv2 into l_message.
replace '&' with i_msgtab-msgv3 into l_message.
replace '&' with i_msgtab-msgv4 into l_message.
endif.
condense l_message.
write: /2 i_msgtab-msgtyp, l_message(250).
else.
write: /2 i_msgtab.
endif.
endform. " process_messageHope this will help.
Regards,
Ferry Lianto
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |