Current Position:Home > Referencing Sales Order to a Quotation via BAPI

Referencing Sales Order to a Quotation via BAPI

Update:11-30Source: network consolidation
Dear all,
I encouter problems to reference a Sales Order to a Quotation when I try to use the SAP BAPI 'BAPI_SALESORDER_CREATEFROMDAT2'. Even though later when I managed to create the referencing on both the Sales Order Header and Sales Order Line to the Quotation, the system still doesn't closed the Quotation status as Completed. This has caused the Quotation remains active and open for other Sales Order for referencing. Any ideas?
Thank you and regards;
-ah tiang-

The Best Answer

According to OSS note 370988 it seems you can't create sales order properly with reference to quotation using BAPI_SALESORDER_CREATEFROMDAT2 in straight-forward way:
This note describes the problems of the 'Create with reference' function when using BAPIs to create sales documents.
If you are working online, you can use this function module to create a sales document with reference to an existing sales document or a billing document (for example, a debit or credit memo request) according to fixed rules. The rules for transferring information from the source document to the target document are defined in the copying control on header and item level. The creation with reference permits an item selection.
When you use BAPIs in SD, a function of this type is not fully available. A reference is only possible for a quantity contract, so that the target quantity of the contract can be reduced by the order quantity of the sales document. Furthermore, the document flow is also updated.
As an alternative to 'Create with reference' in Transaction VA01, two variants are provided for solving the 'Create with reference' problem in the BAPI.
1. Create a '1:1 ' - that is, a document copy of a sales document (customer quotation, order) with 'BAPI_SALESDOCUMENT_COPY'. At this point, you cannot create the 1:1 copy of either a billing document or a delivery.
2. Create a sales document that refers to an existing document with 'BAPISDORDER_GETDETAILEDLIST' and 'BAPI_SALESORDER_CREATEFROMDAT2'.
Reason and Prerequisites
As of yet, no method exists for creating a sales document that refers to an existing document.
For solution No. 1
1. Create the documents using the BAPI_SALESDOCUMENT_COPY function module. However, this only permits a 1:1 copy without factoring out individual items.
2. After you have created the document copy, you can use a change BAPI to edit this copy.
For solution No. 2
1. Collect the data for the reference document (for example a customer quotation) with the 'BAPISDORDER_GETDETAILEDLIST' function module. In the example code, focus exclusively on the partners, items, schedule lines and conditions.
2. Prepare the Data. Execute the 'copying control' manually. This way, you decide which values are to be transferred.
3. Create the sales document using the 'BAPI_SALESORDER_CREATEFROMDAT2' function module by transferring the prepared data.
4. Finally, you must remove a COMMIT WORK so that the sales document can be written into the database.
An example of solution 2 is attached as a text file. You are allowed to select items and quantities for example, if you use input parameters. If there are no entries, then transfer 1:1 from the reference document. When you enter the 'condition type' parameter, you can determine whether conditions are copied or recalculated ('G' for transferring from the preceding document; 'B' or ' ' for re-determining, and 'C' for re-determining with transfer of the manual elements).
Hope it helps.
And welcome here on SDN!
  • Referencing Sales Order to a Quotation via BAPI Update:11-30

    Dear all, I encouter problems to reference a Sales Order to a Quotation when I try to use the SAP BAPI 'BAPI_SALESORDER_CREATEFROMDAT2'. Even though later when I managed to create the referencing on both the Sales Order Header and Sales Order Line to

  • Error V2 005 when creating a sales order from a quotation Update:10-11

    I hope someone can come up with some ideas to help me with this error. My client is creating a sales order from a quotation and immediately on the first screen the error V2 005 pops up. The quotation was not created with reference to any previous doc

  • How to create a Sales order from multiple quotations? Update:11-30

    Hi All, Please tell me how to create one sales order from multiple quotations? Regards, MaddyHello Maddy, To create the sales order from multiple quotation, you should put the value "F - Only at item level: Always with selection option" under Qu

  • Cannot change Tax Code from the referenced sales order line Update:11-30

    hi, Has anyone ever got this error when creating Sales Order(SO): "*cannot change Tax Code from the referenced sales order line*"? The error occur with order type Return. This SO is created by copying from another SO. Please help. Regards &

  • Create sales order from multiple quotation Update:11-30

    Hi All, How we can create sales order from multiple quotation what is transaction code for this. AhmedHi Ahmed, There are two options. 1. For creating Sales Order with ref to too many Quotations: Go to T. Code VA26 and enter the Doc Date or Quotation

  • No new item in sales order refernced from quotation Update:10-11

    Dear All, I am creating sales order which is referenced from Quotation. I should not able to add item directly in sales order other than item which i got from quotation. i have checked copy control of QT to OR but could not find how can i do this? pl

  • LSMW to create Sales Order refer to Quotation with multiple line items. Update:10-11

    Hi Gurus, I am new to LSMW, and my requirement is that, I have a file downloaded from another system, it is like this: Quotation No.  Sold to party  data        item no.       material no.     quatity 556                         10000012             

  • Multiple Sales Orders from One Quotation. Update:10-11

    Hey SD Gurus, I want to create multiple sales orders referring to one quotation. When I create the first sales order the status from quotation change to Completed and this doesn't enable me to create a new sales order. Please let me know how to satis

  • Creation of an ERP Sales Order or ERP Quotation from CRM Opportunity Update:10-11

    Hello Experts, The scenario is as follows: I have done the cross-system copy control of transaction types and item categories to enable ERP Quotation and ERP Sales Order creation from CRM Opportunity.  However, after saving the CRM Opportunity, when

  • Sales Order Creation against Quotation reference using FM IDOC_INPUT_ORDERS Update:10-11

    Hi Experts,   I have to create sales order against reference of Quotation using Function module IDOC_INPUT_ORDERS. Can any one help me out regarding this. In which segment of IDOC do we need to populate QUOTATION NO.? I am using WE19 with a IDOC and