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

BAPI error message

Former Member
0 Likes
3,145

Hi All,

i'm using a standard BAPI to post documents. i'm calling the BAPI in loop for multiple postings.

The problem is that in some cases, the BAPI is not returning the error mesage in return table and it directly throws it in the screen while the program is in execution. So due to this, the execution is terminated and the remaining data are not posted.

So i would like to know is there any way to catch the direct error messages and display it at the end of program execution?

regards,

Prabhu

4 REPLIES 4
Read only

Former Member
0 Likes
1,720

Can you check if the addition

ERROR_MESSAGE = <some number>

can help you in any way?

Please read ABAP documentation for the key word 'ERROR_MESSAGE' you will know how you to use it.

Read only

former_member404244
Active Contributor
0 Likes
1,720

Hi,

try like this..

after calling bapi say like this..

it will return the return structure ryt.

so do like this.

Loop at itab1

call bapi.

if not it_return[] is initial.

read table it_return with key type = 'E'.

if sy-subrc eq 0.

call the FM 'FORMAT_MESSAGE'.

EXPORTING

id = it_return -id

lang = sy-langu

no = it_return -msgnr

v1 = it_return -message_v1

v2 = it_return -message_v2

v3 = it_return -message_v3

IMPORTING

msg = lv_msg.

now append this error message to some internal table say

move:lv_msg to itab_error-msg.

append itab_error.

endif.

endloop.

Now u r error messages with be thre in the internal table itab_error and finally u can display..

Reward if helpful.

Regards,

Nagaraj

Read only

0 Likes
1,720

Hi,

i would like to describe the problem in detail. i already handled the return messages from the BAPI. but i get some errors which are not returned through return table and directly thrown in the screen. So please help if you have already explored such a kind of problem.

thanks in advance,

Prabhu

Read only

0 Likes
1,720

Hi,

I think there might be some problem with ur data whch u r passing...as far as i concerned the bapi should return messages in the return table..also when u r getting those messages on screen,as unlike BDC bapi don't navigate through screens...

Regards,

Nagaraj