‎2008 Feb 18 6:59 PM
Hi all,
I have created a simple bdc's .
I know the bdcdata strucutre and it's uses .
i dont know exactly about bdcmsgcoll, and how we can use it for error handling .??????
if possible just give me a sample example ..
i am working on xk02 t-code ....
‎2008 Feb 18 8:46 PM
BDCMSGCOLL
BDCMSGCOLL is a structure available in the abap dictonary. We use this to handle errors in call
transaction. We need to declare an internal table like bdcmsgcoll.
When a database table is updated we get some messages like sucessfull , or not sucessfull or sucessful with some warning message. All these messages pass through this structure. We can capture them using a function module called FORMAT_MESSAGE.
Check is WIki for BDC sample program..
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/bdc%2bsample%2bprogram%2bfor%2bxk01
‎2008 Feb 19 12:05 AM
If you are using CALL TRANSACTION then we generally have those errors in BDCMSGCOLL structure
Structure of BDCMSGCOLL.
TCODE -> BDC Transaction code
DYNAME -> Batch input module name
DYNUMB -> Batch input screen number
MSGTYP ->Batch input message type
MSGSPRA -> Language ID of a message
MSGID -> Batch input message ID
MSGNR -> Batch input message number
MSGV1 -> Variable part of a message
MSGV2 -> Variable part of a message
MSGV3 -> Variable part of a message
MSGV4 -> Variable part of a message
FLDNAME -> Field name
Steps for the error handling in CALL TRANSACTION:
LOOP AT IT_DATA.
Populate IT_BDCTAB table
CALL TRANSACTION USING IT_BDCDATA
MODE<A/N/E>
UPDATE<A/S>
MESSAGES INTO IT_BDCMSGCOLL.
if sy-subrc 0.
Call function FORMAT_MESSAGE.
or
Call Funciton BAPI_MESSAGE_GETDETAIL
or
Querry the message Text from teh table T100 for the Messages Collected into IT_BDCMSGCOLL.
The Text in T100-TEXT would be maintained with place holders (&1,&2,&3,&4)
Replace the place holders with Variable Texts from IT_BDCMSGCOLL(MSGV1,MSGV2,MSGV3,MSGV4).
Either APPEND the error message to another internal table IT_ERROR and display it finally or display the record and message immediately.
ENDLOOP.
Rewards if useful.