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

BDC

Former Member
0 Likes
760

Hi everyone a small doubt...

i have declared bdcmsgcoll like bdcmsgcoll as an internal table...and used it appropriately in syntax

program got activated properlyand data got transferred..but i am unaware of how to see the bdcmsgcoll messages...please guide me

6 REPLIES 6
Read only

Former Member
0 Likes
737

Hi,

During debugging after the call transaction statemt get executed , press the table button and enter bdcmsgcoll then u can see the entries in that table.

I think since might not be reading nor printing any where in u r program about bdcmsgcoll table u will not know what the entries are there in it.

Either u read the table and print or check the table entry during debugging

Read only

0 Likes
737

thank you srikanth....

it solved the problem but still a small doubt i kept the loop at bdcmsgcoll1...

and i could see the messages...but in general what are the fields that i have to take in bdcmsgcoll.

Read only

Former Member
0 Likes
737

The BDCMSGCOLL does not have the messages text. It has only the message type, number and message parameters.

You have to read the message text. (recall that the database table T100 stores all the messages.)

There are more than one method of doing this.

Following is the psuedocode for one of the methods.

LOOP for the internal table IT1 which has data value from flat file.

call transcation using....

if SY-SUBRC <> 0.

Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL.

(also use the condition T100-SPRAS = SY-LANGU (the log on language. This is because you need only the message texts in English if the user is logged in English language)

IF message type is E , then, transfer the contents of this particular error record to file x. (TRANSFER......)

( Ignore all other messages. Only consider type 'E' messages. Ignore other types of messages.)

(You can also store the message text from T100 and the error record in another internal table IT2)

.....

....

ENDLOOP.

Alternatively,

Instead of

" Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL."

you can use the function module

WRITE_MESSAGES to read the messages.

Please refer to the function module for the list of parameters.

Also refer FORMAT_MESSAGES function module.

LOOP AT it_messtab.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = it_messtab-msgid

lang = it_messtab-msgspra

no = it_messtab-msgnr

v1 = it_messtab-msgv1

v2 = it_messtab-msgv2

IMPORTING

msg = g_msg

EXCEPTIONS

OTHERS = 0.

IF it_messtab-msgtyp = 'S'.

it_sucess-sucess_rec = g_msg.

it_sucess-lifnr = it_header-lifnr." Based on your field

it_sucess-tabix = v_lines.

APPEND it_sucess.

ELSEIF it_messtab-msgtyp = 'E'.

it_error-error_rec = g_msg.

it_error-lifnr = it_header-lifnr.

it_error-tabix = v_lines.

APPEND it_error.

ELSE.

it_info-info_rec = g_msg.

it_info-lifnr = it_header-lifnr.

it_info-tabix = v_lines.

APPEND it_info.

ENDIF.

ENDLOOP.

Best Regards,

Vibha Deshmukh

<b>*Plz mark useful answers</b>

Read only

Former Member
0 Likes
737

Hi,

Just after call transaction statement check sy-subrc value if it is not equal to 0 then call format_message.

IF sy-subrc <> 0.

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 = t_bdcmsgcoll

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.

then move all the error records to error records internal table .

otherwise (sy-subrc eq 0 ) move all the success records to success records internal table .

I think u require to display only error records or success records , there is no need for u to display the content of bdcmsgcoll.

U require error records to be displayed so that next time u just require to upload that records itself.

Read only

Former Member
0 Likes
737

Hi,

use below logic

call transaction 'MM02' using bdcdata messages wa_messages "N'.

now bdcmsgcoll will have all message related to bdc

loop at bdcmsgcoll.

call function 'FORMAT_MESSAGE'

exporting

id = wa_messages-msgid

lang = sy-langu

no = wa_messages-msgnr

v1 = wa_messages-msgv1

v2 = wa_messages-msgv2

v3 = wa_messages-msgv3

v4 = wa_messages-msgv4

importing

msg = l_msg

exceptions

not_found = 1

others = 2

<b>write i_msg. </b> .

endloop.

Regards

amole

Read only

Former Member
0 Likes
737

Hi,

Also check t100 tables where all messages are stored w.r.t message class

Regards

amole