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

Structure of BDCMSGCOLL

Former Member
0 Likes
3,663

Can any Please Explain me the structure of BGCMSGCOLL?

Points will be awarded to the appropriate answer..

Thnks and rgds,

GIri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,389

Hi,

Unlike batch input methods using sessions, CALL TRANSACTION USING processing does not provide any special handling for incorrect transactions. There is no restart capability for transactions that contain errors or produce update failures.

You can handle incorrect transactions by using update mode S (synchronous updating) and checking the return code from CALL TRANSACTION USING. If the return code is anything other than 0, then you should do the following:

write out or save the message table

use the BDCDATA table that you generated for the CALL TRANSACTION USING to generate a batch input session for the faulty transaction. You can then analyze the faulty transaction and correct the error using the tools provided in the batch input management facility.

Fields in BDCMSGCOLL table are

TCODE

DYNAME

DYNUMB

MSGTYP

MSGSPRA

MSGID

MSGNR

MSGV1

MSGV2

MSGV3

MSGV4

ENV

FLDNAME

Regards,

Rajesh

Can any Please Explain me the structure of BGCMSGCOLL?

Points will be awarded to the appropriate answer..

Thnks and rgds,

GIri

7 REPLIES 7
Read only

Former Member
0 Likes
2,389

Hi,

If you are using CALL TRANSACTION with BDC, then inorder to collect the error messages during BDC execution, BDCMSGCOLL is used.

Any messages that occur during CALL TRANSACTION USING ... are collected in the specified internal table. The internal table must have the structure BDCMSGCOLL.

Example

DATA: BDCDATA TYPE TABLE OF BDCDATA.

DATA: ITAB TYPE TABLE OF BDCMSGCOLL.

DATA: PROGRAM LIKE SY-REPID,

WA_BDCDATA TYPE BDCDATA.

WA_BDCDATA-PROGRAM = 'SAPMS38M'.

WA_BDCDATA-DYNPRO = '0100'.

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'RS38M-PROGRAMM'.

WA_BDCDATA-FVAL = PROGRAM.

APPEND WA_BDCDATA TO BDCDATA.

...

CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'

MESSAGES INTO ITAB.

The structure would collect the screen number, transaction name and error message type, number etc.

Best regards,

Prashant

Read only

Former Member
0 Likes
2,389

Hi

I think its BDCMSGCOLL, is a structure to collect the messages in call transaction method in BDC.

you can define a internal table with same type of BDCMSGCOLL. the message number, message type, message ID are populated in to this and the corresponding message you will get it from the function module format_message by passing those values to get the message text so that you can find what are all the errors occured while updating the database in call transaction method.

Regards,

Read only

Former Member
0 Likes
2,390

Hi,

Unlike batch input methods using sessions, CALL TRANSACTION USING processing does not provide any special handling for incorrect transactions. There is no restart capability for transactions that contain errors or produce update failures.

You can handle incorrect transactions by using update mode S (synchronous updating) and checking the return code from CALL TRANSACTION USING. If the return code is anything other than 0, then you should do the following:

write out or save the message table

use the BDCDATA table that you generated for the CALL TRANSACTION USING to generate a batch input session for the faulty transaction. You can then analyze the faulty transaction and correct the error using the tools provided in the batch input management facility.

Fields in BDCMSGCOLL table are

TCODE

DYNAME

DYNUMB

MSGTYP

MSGSPRA

MSGID

MSGNR

MSGV1

MSGV2

MSGV3

MSGV4

ENV

FLDNAME

Regards,

Rajesh

Read only

0 Likes
2,389

HI Rajesh,

Thnks for ur responce ..

Its a very useful answer, Perhaps if u could be eloborate the Fileds a bit more or else if u could tell me whr i can find the exact details of this structure, then it will be more helpful.

Rgds,

GIRISH

Read only

0 Likes
2,389

Try SE11.. the field descriptions are self-explanatory.

Sudha

Read only

Former Member
0 Likes
2,389

HI

GOOD

BDCMSGCOLL : Collecting messages in the SAP System

But for simplicity sake we would not do any error handling. so we would not use the BDCMSGCOLL Structure.

IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

THANKS

MRUTYUN

Read only

Former Member
0 Likes
2,389

Hai Giri

Check the following Code

it will gives you how to use BDCMSGCOLL

report Z_CALLTRANS_VENDOR_01

no standard page heading line-size 255.

      • Generated data section with specific formatting - DO NOT CHANGE ***

data: begin of it_lfa1 occurs 0,

KTOKK like lfa1-ktokk,

NAME1 like lfa1-name1,

SORTL like lfa1-sortl,

LAND1 like lfa1-land1,

end of it_lfa1.

      • End generated data section ***

data : it_bdc like bdcdata occurs 0 with header line.

*DATA: IT_MESSAGES TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.

*DATA: LV_MESSAGE(255).

data : it_messages like bdcmsgcoll occurs 0 with header line.

data : V_message(255).

data : V_flag.

data : V_datum1 type sy-datum.

data : begin of it_mesg occurs 0,

message(100),

end of it_mesg.

*V_datum1 = sy-datum-1.

parameters : P_Sess like APQI-GROUPID.

start-of-selection.

perform Get_data.

*perform open_group.

loop at it_lfa1.

perform bdc_dynpro using 'SAPMF02K' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-KTOKK'

it_lfa1-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-LAND1'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_field using 'LFA1-NAME1'

it_lfa1-name1.

perform bdc_field using 'LFA1-SORTL'

it_lfa1-sortl.

perform bdc_field using 'LFA1-LAND1'

it_lfa1-land1.

call transaction 'XK01' using it_bdc

mode 'N'

update 'S'

messages into it_messages.

if sy-subrc <> 0.

if V_flag <> 'X'.

perform open_group.

V_flag = 'X'.

endif.

perform bdc_transaction. "using 'XK01'.

endif.

perform format_messages.

refresh : it_bdc,it_messages.

.

endloop.

if V_flag = 'X'.

perform close_group.

endif.

&----


*& Form Get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM Get_data .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\srinu_vendor.txt'

FILETYPE = 'DAT'

TABLES

DATA_TAB = it_lfa1

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " Get_data

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0061 text

  • -->P_0062 text

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR it_BDC.

it_BDC-PROGRAM = PROGRAM.

it_BDC-DYNPRO = DYNPRO.

it_BDC-DYNBEGIN = 'X'.

APPEND it_BDC.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

CLEAR it_BDC.

it_BDC-FNAM = FNAM.

it_BDC-FVAL = FVAL.

APPEND it_BDC.

ENDFORM.

&----


*& Form format_messages

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM format_messages .

loop at it_messages.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = it_messages-MSGID

LANG = 'EN'

NO = it_messages-MSGNR

V1 = it_messages-MSGV1

V2 = it_messages-MSGV2

V3 = it_messages-MSGV3

V4 = it_messages-MSGV4

IMPORTING

MSG = V_message

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

clear : V_message.

endloop.

ENDFORM. " format_messages

&----


*& Form open_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM open_group .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = P_Sess

  • HOLDDATE = V_datum1

KEEP = 'X'

USER = SY-UNAME

.

IF SY-SUBRC = 0.

write : / 'Session Creating wit Name : ',P_Sess.

ENDIF.

ENDFORM. " open_group

&----


*& Form close_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM close_group .

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDFORM. " close_group

&----


*& Form bdc_transaction

&----


  • text

----


  • -->P_0132 text

----


FORM bdc_transaction. "USING VALUE(P_0132).

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'XK01'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

DYNPROTAB = it_bdc

  • EXCEPTIONS

  • INTERNAL_ERROR = 1

  • NOT_OPEN = 2

  • QUEUE_ERROR = 3

  • TCODE_INVALID = 4

  • PRINTING_INVALID = 5

  • POSTING_INVALID = 6

  • OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " bdc_transaction

batch input methods using sessions, CALL TRANSACTION USING processing does not provide any special handling for incorrect transactions. There is no restart capability for transactions that contain errors or produce update failures.

You can handle incorrect transactions by using update mode S (synchronous updating) and checking the return code from CALL TRANSACTION USING. If the return code is anything other than 0, then you should do the following:

write out or save the message table

use the BDCDATA table that you generated for the CALL TRANSACTION USING to generate a batch input session for the faulty transaction. You can then analyze the faulty transaction and correct the error using the tools provided in the batch input management facility.

Thanks & regards

Sreeni