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

Create Purchase order while saving Sales Order.

Former Member
0 Likes
1,910

Hello Guys,

I have business requirement to generate PO while saving sales order in VA01. I have called the Bapi (bapi_po_create1) in user exit

User_save_document and generated PO successfully but i am not able to capture account assignment category into PO..When i tried to pass Category

i got error saying Sales Doc number is deleted or archived. after analysis i found out reason of error cause sales Doc no which is generated  in VA01 but not committed in Table during exit...I tired both option also by calling Bapi in 1. Perform XXX ON Commit 2. FM in Update Task..but still getting error..

Kindly suggest any other logic if any one has worked on same issue?

Hello Guys,

I have business requirement to generate PO while saving sales order in VA01. I have called the Bapi (bapi_po_create1) in user exit

User_save_document and generated PO successfully but i am not able to capture account assignment category into PO..When i tried to pass Category

i got error saying Sales Doc number is deleted or archived. after analysis i found out reason of error cause sales Doc no which is generated  in VA01 but not committed in Table during exit...I tired both option also by calling Bapi in 1. Perform XXX ON Commit 2. FM in Update Task..but still getting error..

Kindly suggest any other logic if any one has worked on same issue?

6 REPLIES 6
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,290

Use the BTE 00501014: ( Sales order was created, changed, deleted ) for your purpose. The sample interface is available in function SAMPLE_INTERFACE_00501014( which you can copy to your Z function & wrap the bapi in it ). Please search in SCN for details of how to use BTE and activate it through FIBF.This function is an update function which gets called in the end.You can try calling the bapi in background task inside this.

Read only

former_member16553
Active Participant
0 Likes
1,290

Hi

     Call bapi_po_create1 in background .

cal bapi_po_create1 in background task.

Read only

0 Likes
1,290

Another option would be create Z function module inside it call bapi_po_create1. Put wait statement in Z function module for few seconds to make sure sales order is saved in database. And then call this Z FM in background task.

Read only

0 Likes
1,290

Hi

Use below user-exit to create PO which will trigger after SO creation.

ZXVEDU06

Thanks,

Chandra

Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
1,290

I think you can still use    FORM USEREXIT_SAVE_DOCUMENT   in the include MV45AFZZ.

Create a z- update FM . Put your code to create the PO. and try calling this FM in update task.

If it doesn't work Call the FM in bacground task. Put some wait in loop to check if the sale order is commited to db and procedd to create PO

Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
1,290

I think you can still use    FORM USEREXIT_SAVE_DOCUMENT   in the include MV45AFZZ.

Create a z- update FM . Put your code to create the PO. and try calling this FM in update task.

If it doesn't work Call the FM in bacground task. Put some wait in loop to check if the sale order is commited to db and procedd to create PO