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

Question on BAPI_SALESDOCUMENT_COPY

kasithunuguntla
Participant
0 Likes
1,291

I would like to create a sales order with reference to an existing SO but should not have any reference to the existing order. for ex. if I create a new sales order XYZ with reference to SO# ABC, I could see "ABC" is referenced in document flow of "XYZ".

Is there any simple way I could copy sales order without reference. Basically, I need to write a BDC program for which the input is reference SO numbers.

Your ealier response is much appreciated.

Regards

Kasi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
899

You can try using

BAPISDORDER_GETDETAILEDLIST to get all the information from Sales Order ABC, and then use BAPI_SALESORDER_CREATEFROMDAT1

Note:- If you do not populate ORDER_HEADER_IN-REF_DOC (Document number of the reference document), i think it will not update document flow.

Inadvertently typed BAPI_SALESORDER_SIMULATE instead of BAPISDORDER_GETDETAILEDLIST.

Message was edited by: Naresh Ganesan

6 REPLIES 6
Read only

Former Member
0 Likes
900

You can try using

BAPISDORDER_GETDETAILEDLIST to get all the information from Sales Order ABC, and then use BAPI_SALESORDER_CREATEFROMDAT1

Note:- If you do not populate ORDER_HEADER_IN-REF_DOC (Document number of the reference document), i think it will not update document flow.

Inadvertently typed BAPI_SALESORDER_SIMULATE instead of BAPISDORDER_GETDETAILEDLIST.

Message was edited by: Naresh Ganesan

Read only

0 Likes
899

I am not able to use BAPI_SALESORDER_SIMULATE to get data from original sales order. It is expecting all information to be entered into internal tables. please let me know how to get all information by just entering existing sales order number.

Read only

0 Likes
899

I think you don´t need to use BAPI_SALESORDER_SIMULATE.

You could only use BAPI_SALESORDER_CREATEFROMDAT1 to create de new SO and populate ORDER_HEADER_IN-REF_DOC with your existing sales order number.

Regards.

Read only

0 Likes
899

The "_SIMULATE" BAPI will not do anything to meet your needs.

I would suggest getting the existing order's details using BAPISDORDER_GETDETAILEDLIST. You must enter the sales order number of the existing sales order into int table SALES_DOCUMENTS.

Then pass this info into BAPI_SALESORDER_CREATEFROMDAT1 to create new SO and populate ORDER_HEADER_IN-REF_DOC accordingly.

Read only

0 Likes
899

I did the same but the new order has reference to the old order. I dont want to do that. I want to create the new order which should look similar to the old one but should not have any reference to the old one.

Read only

0 Likes
899

Do not place a value into ORDER_HEADER_IN-REF_DOC. Leave it empty.