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's

Former Member
0 Likes
570

Hi,

In BDC'S I have to Display the separatly error records and Successful records .

what is the code and concept.

Hi,

In BDC'S I have to Display the separatly error records and Successful records .

what is the code and concept.

3 REPLIES 3
Read only

aakash-neelaperumal
Active Participant
0 Likes
547

Try this

Post using call transaction method**********************************

CALL TRANSACTION 'FB01' USING bdcdata MODE l_type

UPDATE 'S' MESSAGES INTO tl_messg.

***Commit the asynchronous transaction********************************

COMMIT WORK AND WAIT.

***Check if the transaction is sucessful******************************

READ TABLE tl_messg WITH KEY msgtyp = c_s.

Read only

Former Member
0 Likes
547

Hi,

this will help you , after calling the call transaction

put the loop at BDCMSGCOLL TABLE.

IF SY-SUBRC NE 0.

LOOP AT BDCMSGCOLL WHERE MSGTYPE = 'E'

MOVE CURRENT RECORD TO ERROR TABLE.

ENDLOOP.

ELSE.

MOVE CURRENT RECORD TO SUCCESSTABLE.

ENDIF.

CALL TRANSACTION 'FB01' USING bdcdata MODE l_type

UPDATE 'S' MESSAGES INTO BDCMSGCOLL

if sy-subrc ne 0.

loop at BDCMSGCOLL where mestype = e.

move records itab to err_tab.

else.

move records itab to succ_tab.

endif.

Read only

Former Member
0 Likes
547

Hi,

Using function module 'FORMAT_MESSAGE' you can capture the messages.

Here is a sample of the program code for that:

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.

Regards,

Bhaskar