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_PO_CREATE commiting problem

daniel_duras2
Participant
0 Likes
2,187

Hi everyone.

I have a little problem with BAPI_PO_CREATE FM. Purchase order was generated and there is a new number of that order.

After that I have BAPI_TRANSACTION_COMMIT function.

The problem is when I want to select some data from EKKO/EKPO tables after order was created.

There is no PO in that tables. When I wrote :

WAIT UP TO 5 SECONDS

everything is fine...

Regards.

14 REPLIES 14
Read only

Former Member
0 Likes
1,884

So what i a problem. some time it takes few mil seconds to save the data at database level.

Atul

Read only

0 Likes
1,884

All right, but after BAPI_TRANSACTION_COMMIT (even with " wait = 'X' ") all data should be saved ...

When You will generate a great many orders, time which is need to save all data will be longer ...

Read only

0 Likes
1,884

All right, but after BAPI_TRANSACTION_COMMIT (even with " wait = 'X' ") all data should be saved ...

When You will generate a great many orders, time which is need to save all data will be longer ...

Read only

0 Likes
1,884

Hi

You're right,

but u need to decide what it's better for you:

You must accept a compromise beetween performance and the needs of your program.

Max

Read only

0 Likes
1,884

So if I will have some DB update and after this I have COMMIT WORK AND WAIT command I need to wait some time to saving data ?

Read only

0 Likes
1,884

Hi

No! Because you're program'll wait for the end of saving data

Max

Read only

0 Likes
1,884

To max.

Exactly, same situation should be with BAPI_TRANSACTION_COMMIT with wait option... (I suppose).

I see, that all proposals are simply of WAIT TO .. SECONDS modyfications, but I dont want that method.

Read only

0 Likes
1,884

I am not too sure about the WAIT option after the Commit. Just not sure if that solves the problem.

The reason why is that in the documentation for the BAPI there is no reference at all to the requirement of the COMMIT WORK statement... Usually it is.

Edit: Okay, checked and the COMMIT is necessary.

We still chose to use the WAIT UP TO <n> SECONDS (after a read on the Database) to make absolutely sure that the PO is created.

First do a COMMIT WORK AND WAIT, then read the Database, if the PO does not exist, then WAIT UP TO n SECONDS and repeat x times.

It is not a nice solution, but it is safe.

Edited by: Edwin Vleeshouwers on Jun 4, 2009 3:48 PM

Read only

Former Member
0 Likes
1,884

Hi

When u call the BAPI for the COMMIT u should check the parameter for WAIT

Max

Read only

Former Member
0 Likes
1,884

Hi Daniel,

I think After immediately creating PO you try to Retrieve From Table It need Some Seconds To select after Commit So if you Want to retrieve immediately after creating you have to give wait Statement.

Read only

Former Member
0 Likes
1,884

Hello,

i understand from your query that the PO number is getting generated but not storing in table.

i to faced the alike issue ,

i used statement

*

wait up to 2 seconds.

commit work. " use bapi commit work.

*

thanks "& regards,

kat k.

Read only

Former Member
0 Likes
1,884

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = BAPIRETURN.

Read only

Former Member
0 Likes
1,884

Hi,

Try using,



BAPI_TRANSACTION_COMMIT

There will be one parameter, wait
In that you can give the duration like
5 secs or so before commiting the 
transaction.

Hope it helps

Regards

Mansi

Read only

Former Member
0 Likes
1,884

Also the other BAPI_PO_CREATE1 can have this issue...

It can be 'solved' like this:

*   Wait until it is REALLY created and available... For some reason,
*   the purchase order that has been created is not yet available...
*   In case of really bad system performance this can be an issue!
*   For the upgrade, I increase the number of retries and the wait
*   time.
    do 12 times.
      select single ebeln from ekpo into exppurchaseorder
             where ebeln = exppurchaseorder.
      if sy-subrc = 0.
        exit.
      else.
        commit work and wait.                " <-- just to make sure...
        perform wait_sec.
      endif.
    enddo.

Silly, but it works.