2011 Aug 15 12:13 PM
Hi experts,
I have a request to create a PO for a particular item of a sales document, and for the PO created I need to fill one component and to lock it. I found out that the only way to create for sure a PO is the FM BAPI_ORDER_CREATE. To update the components and to lock it I need a BDC. I did not found any FM which might do something like this.
The place where I trigger the creation of PO is user_exit_save_document. My logic is the following: I create the PO with BAPI_ORDER_CREATE in another LUW then trigger commit both with BAPI commit and commit work for this separate LUW, In the same LUW in which I created the PO, after the commit, I call a BDC Function Module that updates the component and locks the PO.
I observed that the BAPI ORDER CREATE works fine - it always creates me a PO. When running in the next step the BDC FM , it always returns me the message "PO (before created) does not exist". In debug Mode everything works fine, PO is created and also BDC FM does not return me any error.
It seems to me that when the logic runs in dialog mode all the PO tables are not updated before I run the BDC. As I am openning a separate LUW and I trigger explicitly COMMIT in this separate LUW I was wondering why does not the update of PO tables take place? Is this because the transaction VA01 does not allow any commits for the programms that are called from the transaction? Or what am I missing?
I did a kind of workaround and I don#t run the BDC only after the batch input is created, but I was wondering why am I wrong.
Thank you for the support,
Florin
Hi experts,
I have a request to create a PO for a particular item of a sales document, and for the PO created I need to fill one component and to lock it. I found out that the only way to create for sure a PO is the FM BAPI_ORDER_CREATE. To update the components and to lock it I need a BDC. I did not found any FM which might do something like this.
The place where I trigger the creation of PO is user_exit_save_document. My logic is the following: I create the PO with BAPI_ORDER_CREATE in another LUW then trigger commit both with BAPI commit and commit work for this separate LUW, In the same LUW in which I created the PO, after the commit, I call a BDC Function Module that updates the component and locks the PO.
I observed that the BAPI ORDER CREATE works fine - it always creates me a PO. When running in the next step the BDC FM , it always returns me the message "PO (before created) does not exist". In debug Mode everything works fine, PO is created and also BDC FM does not return me any error.
It seems to me that when the logic runs in dialog mode all the PO tables are not updated before I run the BDC. As I am openning a separate LUW and I trigger explicitly COMMIT in this separate LUW I was wondering why does not the update of PO tables take place? Is this because the transaction VA01 does not allow any commits for the programms that are called from the transaction? Or what am I missing?
I did a kind of workaround and I don#t run the BDC only after the batch input is created, but I was wondering why am I wrong.
Thank you for the support,
Florin
2011 Aug 15 12:40 PM
Hi
I suppose the problem is the time taken to run the saving process, this process is still running while your BDC is starting.
U should use a COMMIT WORK and WAIT in order to be sure the saving process is over before calling the BDC.
Now I don't understand where you have place the COMMIT for the BAPI
Max
P.S.: BAPI ORDER CREATE doesn't exist in my systen, I have BAPI_PO_CREATE1
Max
Edited by: max bianchi on Aug 15, 2011 1:40 PM
2011 Aug 15 1:06 PM
Hi,
the correct bapi name is BAPI_PRODORD_CREATE.
Kind regards,
Florin
2011 Aug 15 12:43 PM
I hope you're triggering a synchronous update i.e., COMMIT WORK AND WAIT. Or passing the WAIT param to the BAPI_TRANSACTION_COMMIT module.
2011 Aug 15 1:04 PM
Hi,
I am doing synchronous update.
I put in the title transaction VA01, because when I do the same with two reports. R1 is first LUW, R2 is second LUW. Same flow in R2 - create PO, then commit synchronous, then BDC - everything works fine.
Kind regards,
Florin
2011 Aug 15 1:24 PM
If your talking about purchase order to procure that materials to be sold, or a production order for materials to be manufactured, why doesn't your order placement create that as part of your ordering process? Why would you have to do that manually in an SAP system?? If you're talking about the customer's Purchase Order number for this sales order, you have only one of those per sales order...usually required by config at the time the sales order is created.
So I don't understand why you have a manual process following Sales Order creation.
2011 Aug 15 1:35 PM
Hi,
the requirement is to create a Production Order automatically for a particular item of a sales order, if that item contains a particular material. I am not aware of triggering the Production Order (10) creation using a customizing setting as I do not know very well the settings for SD. Can you elaborate a little bit here?
the total scenario is: I create a sales order, then I create in background automatically an item - if an item that was filled by the operator has a particular value in field material group 3, then for the automatically created item I need to create a production order.
Thanks for the support,
Florin
2011 Aug 15 1:46 PM
Hi
I don't know if it's possible to set the system in order to create a production order automatically, but if you want to use your solution I'll do:
- Create a function module to run in update task in the user-exit in VA01
- In this function module I schedule the job for the program to create the Production Order and then to change it, but I place a COMMIT WORK and WAIT between the call of BAPI and call of BDC
Max
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |