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: 

Automatic Create PO order & goods movement

Former Member
0 Kudos

Hi,

I have a function module for create a po order with one ítem (with BAPI_PO_CREATE) and after, create a goods repeceipt for this item (with BAPI_GOODSMVT_CREATE). After each call to the bapi, i make a COMMIT WORK AND WAIT.

When i executed the function module, the po order is created correctly, but the good movement give me an error because my own user is traying the po order.

This is not always. Some times, work correctly, and if i executed in debug mode, always is ok.

I tried with wait sentence, call DEQUEUE ALL, ..., but it don't work.

Some was this problem or know how i solve it?.

Thanks

3 REPLIES 3

Former Member
0 Kudos

Hi Antonio,

2 things

Use the BAPI_PO_CREATE1 as RFC with DESTINATION 'NONE'

Use BAPI_TRANSACTION_COMMIT as RFC with DESTINATION 'NONE'

Wait for 5 Seconds

Then Trigger BAPI_GOODSMVT_CREATE as RFC with DESTINATION 'NONE'

Use BAPI_TRANSACTION_COMMIT as RFC with DESTINATION 'NONE'

You will not get the locking issue ...

Regards

Former Member
0 Kudos

Call FM DEQUEUE_EMEKKOE after BAPI_PO_CREATE.

If you still face issues use WAIT FOR 5 SECONDS after FM call DEQUEUE_EMEKKOE

Former Member
0 Kudos

Hi Antonio,

You could also add the below code just after BAPI_PO_CREATE FM.

       DO 6000 TIMES.

         CALL FUNCTION 'BAPI_PS_PRECOMMIT' .

       ENDDO.

       SET UPDATE TASK LOCAL.

Use after BAPI_GOODSMVT_CREATE FM use SD_DELIVERY_UPDATE FM to update the delivery after Post Goods movement.

Hope it is useful.

Regards,

Adithi