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

error handling in background bapi

aidan_mulcahy
Active Participant
0 Likes
713

Hi,

We have the following:


PERFORM run_bapi ON COMMIT.

 FORM run_bapi.

   CALL FUNCTION 'BAPI_GOODSMVT_CREATE'  IN BACKGROUND TASK
        EXPORTING
             goodsmvt_header  = l_goods
             goodsmvt_code    = l_code
        TABLES
             goodsmvt_item    = l_item
             return           = l_return.

* Error handling work here????

 ENDFORM.

If the bapi fails to carry out the goods movement, we want to see the error somewhere (WF, application log....wherever).

Obviously, if I had control of inside the bapi I could do it but is there another way?

And I don't think any checks for the error after the function call will be reached.

Any suggestions?

Thanks.

1 ACCEPTED SOLUTION
Read only

h_senden2
Active Contributor
0 Likes
599

Normally has every bapi a return structure or return internal table like BAPIRET. It gives the result of the call.

regards,

hans

3 REPLIES 3
Read only

h_senden2
Active Contributor
0 Likes
600

Normally has every bapi a return structure or return internal table like BAPIRET. It gives the result of the call.

regards,

hans

Read only

0 Likes
599

thanks Hans,

yes the lx_return will be populated when the FM is actually run but the function is being run in background so my question is if I check that table after the call function will that code be reached? I am doing a test now to see.....

Read only

0 Likes
599

Hi,

if I don't call the function in background task, the error table is populated but this means that there could be locking issues.

Is there any way to still call it in background but force the FM to populate the error table?

thanks.