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: 

Execute BAPI again on error

Former Member
0 Kudos

Hi Experts,

I have a BAPI and I need to execute this BAPI again after a particular waiting time (e.g 10 sec) once it fails.

How can I achieve this functionality?

Any helpful entry will be rewarded.

Warm regards,

Raman

6 REPLIES 6

naimesh_patel
Active Contributor
0 Kudos

You can read the RETURN table and if the error is there you can use the WAIT syntax to wait for some itme.

Like:

WAIT UP TO 10 SECONDS.

Regards,

Naimesh Patel

Former Member
0 Kudos

Why do you want to wait?

Rob

0 Kudos

Hi Rob,

If I go to debugging mode and execute the BAPI after sometime (after waiting for 10 sec), it runs successfully. That's the reason I want to implement that in my code and try to give it a shot.

Warm regards,

Raman.

0 Kudos

You can achieve this by calling this FM BAPI_TRANSACTION_COMMIT with wait option after your BAPI call.


    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
         EXPORTING
              wait   = 'X'. 

Regards,

Naimesh Patel

0 Kudos

WAITing may or may not work. Adding the wait parameter to the commit is much better.

Rob

Former Member
0 Kudos

In most cases, you get this kind of issues when there is a lock on the object that you trying to update or if you are creating and updating the same object in the same program flow. If it is the first case, introduction of a DO... ENDDO may help. In the later case, BAPI_TRANSACTION_COMMIT with WAIT = 'X' after the create call helps.

DO.

call bapi.

if there is an error in the return messages.

continue.

else.

exit.

ENDDO.