2011 Mar 23 8:59 AM
Hi,
I have to create a sales order with a reference to another order and have to change some fields in the new document.
According to SAP note 370988 the function BAPI_SALESDOCUMENT_COPY should allow to create a sales order with reference to another order.
Unfortunately it doesn't work for me.
The BAPI doesn't return an error and creates a new order but that one is incomplete.
The reason seems to be that VKORG, VTWEG and SPART aren't provided and because of that the new order can't be created completely.
I can find no way to provide these fields to the BAPI.
Has anyone used the BAPI successfully or has found another way to achieve the desired result?
I already checked
batch input: problematic because I have to change partners which are displayed in an table control which can't be controlled reliably from batch input
the second way described in the SAP note: high effort and high risk, as each data field has to be copied explicitly from one represantation to another.
Any help is appreciated.
Kai
Hi,
I have to create a sales order with a reference to another order and have to change some fields in the new document.
According to SAP note 370988 the function BAPI_SALESDOCUMENT_COPY should allow to create a sales order with reference to another order.
Unfortunately it doesn't work for me.
The BAPI doesn't return an error and creates a new order but that one is incomplete.
The reason seems to be that VKORG, VTWEG and SPART aren't provided and because of that the new order can't be created completely.
I can find no way to provide these fields to the BAPI.
Has anyone used the BAPI successfully or has found another way to achieve the desired result?
I already checked
batch input: problematic because I have to change partners which are displayed in an table control which can't be controlled reliably from batch input
the second way described in the SAP note: high effort and high risk, as each data field has to be copied explicitly from one represantation to another.
Any help is appreciated.
Kai
2011 Mar 23 11:05 AM
Why don't you just read the data from VBAK and VBAP and use for example
BAPI_SALESORDER_CREATEFROMDAT1 to create new one ?
2011 Mar 23 11:46 AM
That approach would effectively duplicate the implementation of BAPI_SALESDOCUMENT_COPY, wouldn't it?
As there is a lot more data involved than just VBAK/VBAP (e.g texts, partners, conditions, schedules) this is not only a lot more effort it's also harder to get it right, especially since there might also be copy control customization which has to be take into account.
Nevertheless I tried it and it isn't working in my case.
I' have to create a debit memo request (BUS2096) out of a sales order (BUS2032), and BAPIs SALES_ORDER_CREATE* only handle BUS2032.
2011 Mar 23 12:12 PM
I don't think it is the right way to use BAPI_SALESDOCUMENT_COPY to create a debit memo with reference to the order. You can create BUS2096 object with RFC "SD_SALESDOCUMENT_CREATE". For extracting the details of sales order, function module [SHP_GET_SD_DATA |http://wiki.sdn.sap.com/wiki/display/ABAP/SHP_GET_SD_DATA-FunctionmoduleforExtractingSalesorderDetails] will be helpful.
2011 Mar 23 1:45 PM
Why specifically do you think that BAPI_SALESDOCUMENT_COPY shouldn't be used?
I meanwhile solved the problem by enhancing the copy control routine to also copy VKORG/VTWEG/SPART.
That way the debit memo is created as expected with BAPI_SALESDOCUMENT_COPY.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |