Creation of sales order with reference to Quotation using BAPI

Hi All,
I am using BAPI "BAPI_SALESORDER_CREATEFROMDAT2" for creating sales order. Can you please tell how can I create a sales order with reference to a Quotation.

Vinit,
In your header structure, set like this:
  hdr-REF_DOC = i_order-vbeln.  "assign quotation # to sales order
  hdr-REFDOC_CAT = 'B'.         "assign Quotation to VBTYP_N.
For each line item, set as follows:
Assigning ref doc to create line item entries in VBFA.
    itm-REF_DOC    = i_order-vbeln.  "quote number
    itm-REF_DOC_IT = i_vbap-posnr.   "quote line item #
    itm-REF_DOC_CA = 'B'.
  data: ret_text type BAPIRET2.
  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
      ORDER_HEADER_IN           = hdr
      convert                   = 'X'
    IMPORTING
      SALESDOCUMENT             = salesdoc
    TABLES
      return                    = ret_tbl
      ORDER_ITEMS_IN            = itm
      ORDER_PARTNERS            = prtnr
      ORDER_ITEMS_inx           = itmx
      ORDER_CONDITIONS_IN       = conds
      ORDER_CONDITIONS_INX      = condsx
      order_schedules_in        = schd_lin.
Don't forget those points.

Similar Messages

  • Creation of sales order with reference to inquiry no.

    Hi gurus!
    Im having trouble in creation of sales order with reference to inquiry no. The scenario is like this one. In va11(creation of inquiry no.), in the field of <b>SERVICE LEVEL</b>, i indicated a value. after the creation of inquiry no, i want to create a sales order with reference to inquiry no. But the problem is, the <b>SERVICE LEVEL</b> field does not have any value. What is the main problem to this scenario? is it the VARIANT CONFIG or the program itself? please help its urgent
    Regards,
    Mackoy

    Dear Machoy,
    In IMG under
    Sales and Distribution -> Sales -> Sales Documents -> Maintain Copy Control for Sales Documents -> Copying Control: Sales Document to Sales Document
    or Transaction VTAA
    http://help.sap.com/erp2005_ehp_02/helpdata/en/70/a7853478616434e10000009b38f83b/frameset.htm
    If you create a sales document with reference to a preceding document, the system copies nearly all the data from the preceding document. The data in the preceding document originally comes from the customer and material master records. Because the data is copied from the preceding documents into the sales document, any changes that have been made to the master data records since the preceding document was created are not included in the sales document. If, when you create with reference, you add another item to the document that was not in the preceding document, the system determines the data for it from the master records, such as the material master or info record.
    You have created an inquiry and a quotation with reference to this inquiry. Before you created the quotation, you changed some data in the material and customer master records.
    You have changed the material description in the material master record. This description is stored in the sales document at item level.
    You have changed the terms of payment in the customer master record from ZB01 to ZB03. These are stored in the sales document at header level.
    When you created the inquiry, the system copies the original material description to the item. If you enter another item in the quotation for the same material, the system displays the new material description for the new item.
    However, the system continues to propose the original term of payment, that is, ZB01, for all items including the new one. This is because it is copied from the header of the preceding document into the header of the quotation, and the change in the customer master record has no affect on the quotation.
    Regards,
    Naveen.

  • HOW TO CONTROL ON CREATION OF SALES ORDER WITH REFERENCE TO EARLIER SO?

    Dear All,
    I want to contol on creation of Sales order with reference to earlier SO?  While creation of sales order our enduser are creating sales order with reference to earlier month SO which I want to restrict. Recently I made changes in sales order like payment terms is grayed, system will atomatically pick pay terms from customer master.Now I am getting correct data also but enduser is using old SO no while creating new SO and old payment data is reflecting in fbl5n.
    I want to restrict enduser while creating new SO with ref. to old SO. Only for returns they should be able to use Billing refrence. Pl. suggest how to control the with reference to ealier SO.
    Nikhil

    Nikhil Deshpande,
          If you dont want allow create a sales order in referent to other one, just delete the copy control between these sales order type, so when the user tries to create a SO in reference to other one a message is displayed that is not possible.
    Thanks,
    Mariano.

  • G/L Account is missing in item data in sales order with reference to quotation

    Dear SAP Guru,
    I have a problem in accordance with G/L Account missing sales order. Initially, please find the below lines.
    1. If I do the sales order without reference to quotation there is no error in G/L Account missing.
    2. If I do the sales order with reference to quotation there is an error that G/L account is missing in item data.
    I have checked the VKOA, the settings are fine.
    Kindly anyone of you resolve this issue.
    Warm Regards
    Vidya Sagar

    G/L account is missing in item data.
    Many times, it has been discussed on this issue in SCN and please search with the same text so that you will find many threads asking various areas to check.  Take the inputs from there and post here still if you have issue.
    G. Lakshmipathi

  • Creating Sales Order with reference to Quotation from different Sales Area

    Hi,
    I would like to inform you that our customer (GE ENERGY OC) from Europe have a requirement where they want to create sales orders with reference to quotation that is from different sales area. Standard SAP functionality doesn't allow this feature, hence requesting your help to give me an update in this regard.
    Please treat this as urgent as they have to do business cutover where they are in the process of completing open sales orders.
    Thanks
    Ashfaq
    Mobile: +91-98857-07558
    E-Mail: [email protected]

    Hi RadhaKrishna,
    In standard system it is not possible to create sales order from a quotation whose sales are is different.
    However I think this is possible by using some user exit in sales order. I have never tried this.
    Regards
    srini

  • Sales order with reference to quotation

    How to use BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order with reference to quotation? what parameters I need to fill in?

    Hi,
    I've also had this problem.
    In the past when faces with this requirement I have used
    BAPI_READ_SALES_DOCUMENT (Note:  I am away from a system today so that may not be the EXACT name of the funciton module but it's close ) to read in the document data from the quote, then transfer that data to the input structures of BAPI_SALESORDER_CREATEFROMDAT2.  Seems to work reasonably well although it doesn't offer much in the way of automatic error handling.
    Hope this helps,
    Regards,
    Brent

  • COPY CONTROL: SALES ORDER WITH REFERENCE TO QUOTATION

    Hi.
    We are creating a sales orders with reference to a quotation. When copying, we'd like to be able to include another new position type in the sales orders.
    For example:
    QUOTATION:
    POSITION 10: TYPE ZTAB
    SALES ORDERS:
    POSITION 10: TYPE ZTAB
    POSITION 20: TYPE IRSS.
    Where could we place this change?. We suppose when saving the sales orders. Does anybody know how could we make this change?.
    Thank you very much!.
    Raú

    What do you mean by position type?
    Please use the language used by SAP so that it could be easily understood.
    What is ZTAB & IRSS. Are they materials?
    Regarding copying, this is a brief theory
    In copy control, you define control data for the document flow of sales documents.
    You can specify for a particular sales document type, which document type is to be assigned to copied reference documents, and which item categories or schedule line categories are to be copied.
    You must also make specifications for copying requirements and data transfer, as well as quantity and value updates in document flow.
    In precise, you are telling the system what data to copy from QT to sales order. It copies data from Quotation order type to Standard order type basing on settings you indicated in copying control.
    System won't do anything more than copying from preceding documents and it would transfer data based on copying rules in copy control.

  • Sales order with reference to quotations.

    Hello Experts ,
    I want to know how can a sales order be created with reference to more than one quotation??
    Is there a transaction to do this ?? or else its a process?? Please guide. points will be rewarded to the answers.
    Thanks,
    Arathi

    Hi Arathi Rajan,  ALL ARE GIVEN WRONG ANSWERS TO YOU : SORRY TO SAY THAT ....
    YES YOU CAN CREATE ONE SALES ORDER WITHR EFERENCE TO MULTIPLE QUOTATIONS:
    FOLLOW ME:
    1). GO TO VA01 SCREEN ENTER ORDER TYPE : OR
    ENTER SALES AREA
    2). SELECT THE ICON " WITH REFERENCE TO QUOTATION"
    AND THEN COPY THE 1 QUOTATION DETAILS, THEN IT WILL TAKE YOU TO SALES ORDER SCREEN, THERE U WILL FIND ONE LINE ITEM . OK
    3). THEN, IF U WANT TO ENTER MULTIPLE QUOTATIONS:
    SALES DOCUMENT- SELECT CREATE WITH REFERENCE AND SELECT THE MULTIPLE QUOTATIONS LIKE THIS:
    4). NOW U CAN ABLE TO CREATE THE SALES ORDER WITH REFERENCE TO MULTIPLE QUOTATIONS.
    HOPE IT HELPS YOU ,
    Thanks&Regards
    Venkat.Dhanemkula

  • BAPI: Create Sales order with reference to Quotation

    Hi ...
    I am using bapi BAPI_SALESOREDER_CREATEFROMDATA2  and
    i want to create sales order with reference Quotation... All quotation data like Materials prices and conditions must be copied from reference quotaion which is allready created .....
    ..Thanks..
    ..Ashish

    Hello,
    nice to see that this has already been solved.
    But it actually doesnt work in my scenario. Do you have an example coding which will explain your solution.
    Mine looks like this:
    * Update Flag
      ls_header_inx-updateflag = 'I'.
    * Angebotskopf einlesen
      SELECT SINGLE * FROM vbak INTO ls_vbak
        WHERE vbeln = iv_vbeln
          AND vbtyp = lc_vbtyp.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
    * Auftragskopf setzen
      ls_header_in-doc_type      =  ls_vbak-auart.
      ls_header_in-sales_org     = ls_vbak-vkorg.
      ls_header_in-distr_chan    = ls_vbak-vtweg.
      ls_header_in-division         = ls_vbak-spart.
      ls_header_in-req_date_h   = ls_vbak-VDATU.
      ls_header_in-ref_doc        = ls_vbak-vbeln.
      ls_header_in-refdoc_cat   = 'B'.
    * Angebots-Partner einlesen (Nur AG und WE)
    * Auftrag anlegen
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
    *   SALESDOCUMENTIN               =
          order_header_in               =  ls_header_in
    *      order_header_inx              = ls_header_inx
    *   SENDER                        =
    *   BINARY_RELATIONSHIPTYPE       =
    *   INT_NUMBER_ASSIGNMENT         =
    *   BEHAVE_WHEN_ERROR             =
    *   LOGIC_SWITCH                  =
    *   testrun                       = 'X'
    *   CONVERT                       = ' '
       IMPORTING
          salesdocument                 = ev_vbeln
        TABLES
          return                        = et_return
    *      order_items_in                = lt_items_in
    *      order_items_inx               = lt_items_inx
          order_partners                = lt_partners
    *   ORDER_SCHEDULES_IN            =
    *   ORDER_SCHEDULES_INX           =
    *   ORDER_CONDITIONS_IN           =
    *   ORDER_CONDITIONS_INX          =
    *   ORDER_CFGS_REF                =
    *   ORDER_CFGS_INST               =
    *   ORDER_CFGS_PART_OF            =
    *   ORDER_CFGS_VALUE              =
    *   ORDER_CFGS_BLOB               =
    *   ORDER_CFGS_VK                 =
    *   ORDER_CFGS_REFINST            =
    *   ORDER_CCARD                   =
    *   ORDER_TEXT                    =
    *   ORDER_KEYS                    =
    *   EXTENSIONIN                   =
    *   PARTNERADDRESSES              =  .
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    Unfortunatly this just makes the reference to the quotation but does not takeover ALL data from header and pos level.
    Thanks and regards
    Markus Armbruster

  • Create Sales Order with Reference from Quotation

    Hi All,
    Is there any bapi or function to create sales order with reference from a quotation?
    I know BDC is possible but any other methods?
    Thanks
    Dyl

    You can use - BAPI_SALESDOCUMENT_COPY.
    Prerequisite is Copy control should exist in customizaiton.
    -Alpesh

  • Creation of sales order with reference - Zfields in Add data B are not cop

    Hi all,
              Please help me in the issue . I am creating sales order with reference to returns order . All item fields are getting copied but the Zfields which are added in addtional data b of sales order are not getting copied. Can anyone please let me know the procedure to copy the custom fields.
    Thanks in advance,

    The setting of field when copy by reference is best done in the copy rules.
    If you go to transaction VTAA, and look to the order type you are copying to, you will find a data transfer rule number. 
    Then go to transaction VOFM, menu option DATA TRANSFER -> ORDERS and find the matching data transfer rule number.
    Select and press the "Source text"  button, here you will find the data from the copied order in structure CVBAK, and you can apply the code to set the VBAK structure fields appropriately.
    This should then populate the data on the copied order.

  • Problem with creation of Sales Order with reference to Contract

    Hi,
    I have a problem when creating Sales order with reference to Contract , shipping condition was not copied. Is there any existing copy routines suitable to accomodate this?
    Thanks!

    your functional team can help you in finding one.

  • Create a Sales Order with Reference to Contract using IDoc / LSMW  ( AFS )

    Hi Gurus,
    I need to crate a Sales Order with reference to a Contract. I need to upload Sales Orders with reference to contract via LSMW.
    So far, I've been able to create the Sales Order with ref to contract. But, the Sales Order Quantity is not getting deducted from the Original Qty in Referred Contract ( When try to create another Sales Order referring to the same Contract.) When a Sales Order is created manually, this is working fine.
    Please tell me if I've missed some parameter which stopping it create the link to exact schedule line ( Sizes level )
    The Details of the IDoc which is been created via LSMW are as follows;
    Message Type: ORDERS
    Basic Type     : /AFS/ORDERS05
    Process Code : ORDE / DELO
    ( Tried with both process codes.  But the Identification is the same for both: IDOC_INPUT_ORDERS )
    *_In Header;_
    Segment : E1EDK02  - IDoc: Document header reference data *
    Qualifier : '043' - Vendor Contract Number ( Tried with ' 005' - Customer Contract, but it's not working )
    Contract Order is mapped for field BELNR
    *_In Item;_
    Segment : E1EDP02  - IDoc: Document Item Reference Data *
    Qualifier : '043' - Vendor Contract Number ( Tried with ' 005' - Customer Contract, but it's not working )
    Contract Order is mapped to field BELNR
    Line Item of the Contract is mapped to field ZEILE
    I also tried passing the Schedule line of Contract in Segment :  E1J3P01 AFS IDoc: Doc.item general data
    to following fields;
    J_3AETENV
    J_3AVGETE
    /AFS/UETENR
    Still its not getting updated in the VBEP also..
    Please help me with regard to this. Points will be awarded for your valuable contribution.
    Thanks.

    Hi,
    This issue is been resolved.
    One of my friend helped me with resolving this issue..
    Once the below mentioned configurations were done on SPRO, the Sales Order was created with reference to Contract and the Qty was reflected when tried to create a new Order referring the same contract.;
    u2022     SPRO --> SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Define Sales Document Types  --> Field : Outline agreement message; from blank to u201CBu201D.
    u2022     SPRO  -->SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Maintain Sales Document Types for AFS  --> Field : Outline agreement message; from blank to u201CAu201D

  • CREATE SALES ORDER WITH REFERENCE TO INVOICE USING RECORDING

    Hi,
    I wanted to know if it was possible to create a sales order with reference to an invoice using recording(SHDB transaction).If there is some other method please explain the method in detail(Its very urgent)

    Hi,
    You should be able to use BAPI_SALESORDER_CREATEFROMDAT2 instead of doing a BDC and you can populate the reference document in the relevant header field.
    Gareth.

  • Sales order with reference to contract using IDOC_INPUT_ORDERS

    Hi all,
    I had the requirement to create sales order with reference to contract based on some validations of idoc values and then passing the modified idoc data table to IDOC_INPUT_ORDERS. I have completed the coding till the modification of data in a new function module ('Z') and then calling the IDOC_INPUT_ORDERS FM inside that. Now my problem is while creating the sales order, the bdc for Txn VA01 is not populating those values to screen fields which I want to populate. I could find out that some modifs needs to be done in some user exit for reference to contract case.But finding difficulty in getting the exact place to make the modifications. Any pointer to this problem would be highly appreciated.
    Regards,
    Divya

    Hi,
    This issue is been resolved.
    One of my friend helped me with resolving this issue..
    Once the below mentioned configurations were done on SPRO, the Sales Order was created with reference to Contract and the Qty was reflected when tried to create a new Order referring the same contract.;
    u2022     SPRO --> SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Define Sales Document Types  --> Field : Outline agreement message; from blank to u201CBu201D.
    u2022     SPRO  -->SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Maintain Sales Document Types for AFS  --> Field : Outline agreement message; from blank to u201CAu201D

Maybe you are looking for