Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

bdcmsgcoll

Former Member
0 Likes
998

explain me about bdcmsgcoll structure and messtab in call transaction method

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
0 Likes
801

You can get all the messages back form the CALL TRANSACTION in to the table whit the structure BDCMSGCOLL.

data begin of ctumsg occurs 10.        "messages call trans.using "yht09
        include structure bdcmsgcoll.                       "yht09
data end of ctumsg.                                         "yht09

  if not ctumsg[] is initial.
*  Handle your error messages
  endif.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
801

HI

Structure of BDCMSGCOLL

MSGID Message ID

MSGTYP MessageType

MSGNR Message Number

MSGV1 1st placeholder

MSGV2 2nd Place Holder

NSGV3 3rd Placce Holder

MSGV4 4th Place Holder

To see all the messages stored by the system in the BDCMSGCOLS table we can use LOOP AT .ENDLOOP command.

http://sap.niraj.tripod.com/id50.html

Read only

Former Member
0 Likes
801

Hi Shankar,

Call transaction method doesn't handle error, So we should handle the error explicitly using BDCMSGCOLL structure .

Structure Contains following fields,

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

Ex :

DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,

BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.

CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.

IF SY-SUBRC <> 0.

PERFORM ERR.

CLEAR I_MSG.

REFRESH I_MSG.

ENDIF.

&----


*& Form ERR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form ERR .

DATA V_MSG(255) TYPE C.

READ TABLE I_MSG WITH KEY MSGTYP = 'E'.

IF SY-SUBRC = 0.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = I_MSG-MSGID

LANG = 'E'

NO = I_MSG-MSGNR

V1 = I_MSG-MSGV1

V2 = I_MSG-MSGV2

V3 = I_MSG-MSGV3

V4 = I_MSG-MSGV4

IMPORTING

MSG = V_MSG

  • 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.

WRITE V_MSG. " Error Message Displayed Here.

CLEAR V_MSG.

ENDIF.

endform. " ERR

Regards,

Vijay