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: 

Calling a BAPI within a BAdi

Former Member
0 Kudos

Hi,

This is the problem: I'm using BAdi IF_EX_PROJECTDEF_UPDATE to get changes made to a project structure. I then call a BAPI to update some custom tables, but the problem is that the data isn't available until the BAdi (method) has finished.

This means that when my BAPI starts, the data it is looking for isn't in the tables yet. Is there any way to run the BAPI after the method has finished? I've tried by running it in update task and background but with no luck,

Kulbir

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

In update task the database commit may not have been executed, but in "background" it should have been. Maybe there are some long time of response of your system (relatively)

Your function module may begin with a select (with all necessary DO, WAIT and ENDDO) to insure the database commit is at end before executing the BAPI.

Regards

2 REPLIES 2

raymond_giuseppi
Active Contributor
0 Kudos

In update task the database commit may not have been executed, but in "background" it should have been. Maybe there are some long time of response of your system (relatively)

Your function module may begin with a select (with all necessary DO, WAIT and ENDDO) to insure the database commit is at end before executing the BAPI.

Regards

Former Member
0 Kudos

One thing you can try is to build a 'WAIT' logic in the BAPI itself. You are saying that you are trying to update the data in your custom table and that data will be available only when your method is finished.

I assume that your data you want to update will be available via SELECT query and should be available

with in 10 min or so

Inside BAPI :

Do 10 times.

  • SELECT query to get the data.

if sy-subrc <> 0.

wait for 60 seconds.

else.

exit.

endif.

ENDDO.

and In your BADI , Call You BAPI in BACKGROUND task. The first commit after the background task call will trigger the eecution of your BAPI.

Hope this works

Regards

Saket Sharma