Application Development 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: 

Displaying messages after BDC execution

Former Member
0 Kudos

Dear All,

I am running a BDC to change the pricing of the return document in transaction VA02. The BDC is getting executed after the execution of one report which is diaplying some records in the output. The output values of the report are : Check Box, Sales Document No & Billing Document No.

After the BDC is executed for the selected records, I am getting a screen which displayes me for each record if that has been executed successfully or is there any error while executing BDC.

Now, I want that after the BDC has been executed, a list should be displayed which just shows about the Sales Document No which has been processed successfully by the BDC and another list which displays about the Sales Document No which are not processed successfully.

Kindly guide me on how I can proceed on this.

Waiting for your reply.

Warm Regards,

N.Jain

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

WHEN YOU UPDATE DATABASE TABLE, OPERATION IS EITHER SUCCESSFUL OR UNSUCCESSFUL OR OPERATION IS SUCCESSFUL WITH SOME WARNING. THESE MESSAGES ARE STORED IN INTERNAL TABLE, WHICH YOU SPECIFY ALONG WITH MESSAGE STATEMENT. THIS INTERNAL TABLE SHOULD BE DECLARED LIKE BDCMSGCOLL, A STRUCTURE AVAILABLE IN ABAP/4. IT CONTAINS THE FOLLOWING FIELDS: TCODE, DYNAME, DYNUMB, MSGTYP, MSGID.

Please reward points if helpful.

5 REPLIES 5

Former Member
0 Kudos

Hi,

WHEN YOU UPDATE DATABASE TABLE, OPERATION IS EITHER SUCCESSFUL OR UNSUCCESSFUL OR OPERATION IS SUCCESSFUL WITH SOME WARNING. THESE MESSAGES ARE STORED IN INTERNAL TABLE, WHICH YOU SPECIFY ALONG WITH MESSAGE STATEMENT. THIS INTERNAL TABLE SHOULD BE DECLARED LIKE BDCMSGCOLL, A STRUCTURE AVAILABLE IN ABAP/4. IT CONTAINS THE FOLLOWING FIELDS: TCODE, DYNAME, DYNUMB, MSGTYP, MSGID.

Please reward points if helpful.

0 Kudos

Look at following code

call transaction 'MI01' using itab_bdcdata mode 'A' MESSAGES INTO

ITAB_msg.

CLEAR itab_bdcdata[].

loop at itab_msg where msgtyp = 'S'.

break-point.

message i010(zmgs) with itab_msg-MSGV1.

docno = itab_msg-msgv1.

endloop.

see this and code accordingly for Sucees and Error message

varma_narayana
Active Contributor
0 Kudos

hi Nishu..

Use the BDCMSGCOLL structure to capture the Messages:

Using BDCMSGCOLL Structure we have to declare an itab.

DATA : IT_MSG LIKE TABLE OF BDCMSGCOLL .

Then We can catch the messages using:

CALL TRANSACTION 'MK01'

USING IT_BDCDATA

MODE 'N'

MESSAGES INTO IT_MSG.

IF sy-subrc ne 0.

LOOP AT IT_MSG INTO WA_MSG

WHERE MSGTYP = 'E' OR MSGTYP = 'A'..

<<process Error messages>>

ENDLOOP.

Else.

LOOP AT IT_MSG INTO WA_MSG

WHERE MSGTYP = 'S'

<<process Success messages>>

WRITE:/ 'Doc No', WA_MSG-MSGV1.

ENDLOOP.

Endif.

<b>reward if Helpful.</b>

Former Member
0 Kudos

hi nishu

call transaction 'va02' using bdcdata mode 'n' update 's' messages into bdcmsgcoll.

loop at bdcmsgcoll.

if bdcmsgcoll-msgtyp = 'e'.

append the error record to an internal table same as existing table.

endloop.

For all records is getting updated the details will apper first by default.

after complition of the bdcprocess at the end of your coding

display the error records form the appended internal table.

hymavathi_oruganti
Active Contributor
0 Kudos

after the call transaction statement, put a sy-subrc check.

if sy-subrc = 0, pass the successfull records to an internal table and sy-subrc <> 0 to another itab.

at the end display the two internal tables that it !!