Order with referance  to a contract using BAPI_SALESORDER_CREATEFROMDAT2

Hi All,
  I tried to create an order with reference to a sales contract .
1) I passed the  contract number to the field REF_DOC at header level , But I got the error message" Document 4000003639 doesn't have document " where 4000003639 was the contract number .  am i missing anything ? Is there any other values that has to be passed ?Can anyone help me on this ?
2) I also tried passing the contract number at  item level as suggested in earlier posts on this subject , but the sales order was created without any reference to the contract .
Please help me on this issue .
Thanks & Regards
Beena

Hi Beena,
You can use this piece of code as reference,
*Fill the header information for the order.
  wa_order_header_in-doc_type           = Sales Doc type of order to be created.
  wa_order_header_in-sales_org          = sales org.
  wa_order_header_in-distr_chan         = distribution channel.
  wa_order_header_in-division           = division.
  wa_order_header_in-ref_doc            = contract number(This is the contract u refer to).
  wa_order_header_in-refdoc_cat         = 'G' (G stands for contract).
*Fill the item level information for the order.
    wa_order_items_in-itm_number        = item number.
    wa_order_items_in-material          = material number.
    wa_order_items_in-ref_doc           = contract number(This is the contract u refer to).
    wa_order_items_in-ref_doc_it        = Item number of contract u create.
    wa_order_items_in-ref_doc_ca        = 'G'.
    APPEND wa_order_items_in TO i_order_items_in.
*Fill the schedule line information for the order.
    wa_order_schedules_in-itm_number    = item number.
    wa_order_schedules_in-sched_line    = 1.
    wa_order_schedules_in-req_qty       = order quantity.
    APPEND  wa_order_schedules_in TO i_order_schedules_in.
    CLEAR: lwa_order_items_in,
           lwa_order_schedules_in.
*Fill the partner information for the order.
    wa_order_partners-partn_role        = partner function.
    wa_order_partners-partn_numb        = partner number.
    APPEND wa_order_partners TO i_order_partners.
           wa_order_partners.
  CLEAR w_vbeln.
*Call the order creation BAPI.
  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
  salesdocumentin               =
      order_header_in             = wa_order_header_in
  order_header_inx              = wa_order_header_inx
  sender                        =
  binary_relationshiptype       =
  int_number_assignment         =
  behave_when_error             =
  logic_switch                  = lv_logic_switch
  testrun                       =
  convert                       = ' '
    IMPORTING
      salesdocument               = w_vbeln
    TABLES
      return                      = i_return
      order_items_in              = i_order_items_in
  order_items_inx               =
      order_partners              = i_order_partners
      order_schedules_in          = i_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 =
IMPORTING

Similar Messages

  • Sales Order with Ref to  Sales Contract using BAPI

    Hi ,
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating the Sales order with ref to Sales Contract.
    but problem is that , Its not validating the quantity.
    I am passing following values to Header  & item
    ORDER_HEADER_IN-REF_DOC   =  <Sales contract>
    ORDER_HEADER_IN-REFDOC_CAT = 'G'.
    & item
    ORDER_ITEMS_IN-REF_DOC   = <Sales contract>
    ORDER_ITEMS_IN-REF_DOC_IT   = <item>
    ORDER_ITEMS_IN-REF_DOC_CA  = 'G'
    Thanks
    Jitendra

    Keshav.T wrote:
    What do you mean by but problem is that , Its not validating the quantity. generally to populate qty we follow like below
    Hi Keshav,
    Suppose Contract -> 1000 L
    First Order -> 500 L wrt to that contract.
    and again create a order wrt contract with quantity  700 L
    It should throw a waring Or Error message  but It creates the Order with 700 L quantity which is not correct.
    Thanks
    Jitendra

  • Create Sales Order With Reference to Billing Document Using BAPI_SALESORDER

    Hi,
    How can i create a sales order With Reference to Billing Document Using BAPI_SALESORDER_CREATEFROMDAT2?
    Thanks in advance,
    Alejandro.

    I have to create sales order with reference to existing billing document. I have tried to following bapis.
    1. BAPI_SALESORDER_CREATEed
    I have successfully created document with following details.
    -->ORDER_HEADER_IN:
    DOC_TYPE =                  ZRK
    SALES_ORG =              3000
    DISTR_CHAN   =            00
    DIVISION =                    00
    ORD_REASON =            100
    SD_DOC_CAT   =          L
    CURRENCY       =         EUR
    REF_DOC          =         100000028
    REF_DOC_CA    =         M
    -->ORDER_ITEMS_IN:
    ITM_NUMBER    =           000010
    MATERIAL          =          701791
    TARGET_QTY     =          0000000001000
    CURRENCY        =          EUR
    REF_DOC           =          100000028
    REF_DOC_CA     =          M
    -->ORDER_PARTNERS:
    PARTN_ROLE      =          SP
    PARTN_NUMB      =         W12001
    COUNTRY             =         NL
    by providing this input i am able to create the document but it is not picking up the net value. so i have passed some extra paramters in  ORDER_ITEMS_IN
    COND_TYPE          =        PNET
    COND_VALUE        =        14,56
    COND_D_UNT        =         PC.
    folowing error is occured: Condition PNET is missing in pricing procedure A V Z0000.
    is it something related to configuration problem?
    2.BAPI_SALESORDER_CREATEFROMDAT1 or BAPI_SALESORDER_CREATEFROMDAT2
    I have used same test data that is used for BAPI_SALESORDER_CREATEFROMDATA (where in i coudl succefully create doc). but here i encounterd following error.
    Unpermitted combination of business object BUS2032 and sales doc. category L.

  • Create sales order with reference to a contract

    Hi,
    Is there any BAPI/FM which can be used to create a sales order with reference to a contract.
    Regards,
    Saji.

    Hi Maninder/Srinivas ,
    Could you please provide your valuable inputs on the below query . I have posted a new thread , but haven't got any reply till now . Sorry for posting it again.
       I want to  create an order with reference to a sales contract using BAPI_SALESORDER_CREATEFROMDAT2  .
    1) I passed the contract number to the field REF_DOC at header level , But I got the error message in return table  " Document 4000003639 doesn't have document category " where 4000003639 was the contract number . am i missing anything ? Is there any other values that has to be passed ?
    2) I also tried passing the contract number at item level  but the sales order was created without any reference to the contract .
    Thanks in advance
    Beena

  • Copy Sales Order with reference to a Contract

    Hello,
    how can I create a copy of a sales order referred to a contract mantaining the reference?
    I have an order referred to a contract; I would like to create a new order in copy ( va01 - create with Reference) maintaining the relationship to the contract.
    Thank to all,
    Antonio

    Hi,
    You can create a new order by referring to a contract by clicking on "Create with reference".
    Click on Contract and enter the contract number here.You can change teh requested delivery date manually.
    Click on Copy.
    Before this,make sure that the copy controls have been mainatined for these two document types.
    Regards,
    Krishna.
    Note:Please search in the forum before posting basic questions.

  • One order with reference to multiple contracts

    Hi,
    As we create one invoice(consolidated invoice) for multiple orders where condition is header data should be same for all the orders.In the same way can we create one order with reference to multiple contracts?
    Please suggest.
    Regards,
    SATYA

    Hi,
    Thanks alot for the information.
    Is this the only way to create one order for multiple contract? Why i am asking because in SAP we are creating contracts but the release order we are getting it uploaded from other software.I am in a service industry project where we do DP91(resource related billing) for all the contract.But in dp91 we can give only one contract at a time.
    But we want to create order where multiple contract can be used .
    And where in order we can see the contract number?
    In the table it is visible as ref doc but not in the order.
    Regards,
    SATYA

  • Issue while creating an order with reference to a contract

    When I try to create an order with reference to a contract having KMATs at line item using VA01, it works fine. But when we try to record the same using SHDB, it comes out after accepting the Contract Number on the pop up screen.
    If some one can throw light as to if it the config issue or any setting that needs to be looked into?

    No special settings. This is a typical problem. SHDB (SM35, or call transaction) can be different to "normal" transaction.
    You can only follow the special sequence given by the transaction running in BDC mode (if you are using exits check on these fields: sy-binpt, sy-calld).
    Kind regards,
    JP

  • How can I create multiple sales orders with reference to one contract?

    Hello Gurus,
    Can you please how can I create multiple sales orders with reference to one contract?
    thanks!
    Rakesh

    hi
    Lets consider example
    In your contract for line item 1 you have entered qty 100
    You careated sales order with 70 quantity, and now you want to creat another sales order for 30
    For this first you need to check what is your item category in contract (VA42)
    Goto VOV7
    SPRO - IMG  - Sales and distribution - Sales - Sales document item - Define item categories - Go to change mode
    Make the completion rule = B Item is completed after full quantity has been referenced

  • Credit memo with reference to a sales order with reference to a contract?

    Hello All
    Now I created a quantity contract and the customer paid the Amount that means the billing is done then I started creating sales orders with reference to the contract, can I create credit memos with reference to these sales orders?
    Regards
    Jacopo Francois

    Hi,
    You can create a contract for a longer duartion say 1 year, andyou can create sales order in reference to your contract. This would be an ideal scenario in case of service materials.
    You can now surely create credit memo's in reference to this sales order.
    You will invoice the sales order first and create a credit memo request in reference to your sales invoice and then invoice the credit memo request to raise your credit memo for the customer.
    Reward if helpful.
    Regards
    Ravi

  • Creation of Sales order with reference to SOW contracts(VA01 )

    I had created sales order using BAPI_SALESORDER_CREATEFROMDAT2 and now i want to attach the document link for each line item.I could not do it in my program or recording.How can i enter these document type?pls help......

    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.

  • Purchase order with ref to central contract

    we have created centrallly agreed contract with one vendor , but client wants to create purchase order using  that contract but with different vendor.(vendor field only ) (not through partner roles and vendor sub range)pl suggest if there is way.

    >
    ramjdee wrote:
    > my queston is,  Is it possible to create the purchase order with different vendor  while creating  w.r to   centrally created contract . The contract is having another vendor . example .  CENTRALLY CREATED CONTRACT VENDOR IS  X , but while creating po with ref to the contract can i use other vendor like Y.
    >
    > vendor sub range and partner roles not to be used .
    Is your problem related to contract and support (in terms of "SAP contract and support"), or are you rather talking about relations between different data objects / tables inside your application? If the latter, being a little more verbose (and, especially, posting table definitions) surely would help.
    Cheers,
    Kristian

  • Create Purchase Order with reference to Purchase Requisition using BAPI's

    Hello Experts,
    I need to create a Purchase order with reference to a Purchase Requisition.
    All the above has to be done by using BAPI's.
    For creating PR, I am using BAPI_REQUISITION_CREATE.
    and for PO, I am using BAPI_PO_CREATE.
    I am not able to use the requistion number in the PO. BAPI throws the following exception
    "Requisition 1014396 00010 not selectable"
    "Document contains no items"
    Query's:
    1. Do I need to release the PR for using it in PO?
    2. If so how can I work with the "BAPI_REQUISITION_RELEASE_GEN" to release PR?
    I have tried using the BAPI getting the following error "Release outside filed of responsibility".
    Please help I am in critical Postion...
    Thanks,
    Suma

    Hi Meenakshi,
    When, I try to release error I am getting the following the error " Purchase Requisition can not be released".
    Is this problem because of authorization or data issue?
    Thanks
    Suma

  • Purchase order with referance to Purchase  requisition

    Dear All,
    This is the requirement of <b>Purchase order creation with reference to Purchase requisition  only at the same time this requirement need to control particular document  type ( Ex: Standard purchase Order) only .</b>Based on this other document types should not effect.
    Please give me the proper solution  for above.
    Regards,
    Krishna

    Dear Krishna Raju,
    There is no configuration for the Purchase order with reference to Purchase requistion..
    We can customise the Purchase order with reference to Purchase Requistion through the funcational authorisations.
    For this,
    Define Functional Authorisations in the customizing for Purchasing, there we can unmark PO w/o reference allowed.
    Functional Authorisation, like ''abc'' create with <b>T.Code OMET</b>
    Assign ''abc'' to a Parameter ID ''def'' with the <b>T.Code SU52</b>
    Mostly this Purchase order authorisations will be give BASIS consultants. Pls approch them for more clarity in this regard.
    With regards,
    B.Ravindranath

  • BOM Re-Explosion at sales order created with referance to Contract

    Hi Experts,
      Need your advise in mapping below requirement.
    Our clinet is into service industry.
    The sales process is  Contract --> Sales Order --> Invoice.Currently all the services will be charged using a BOM.
    The BOM IS Created as below.
    BOM Header Material--- ABC
    BOM Components -
    ABC1
    Now because of additional tax requirements for the services we need to differentiate the services charged to the customer, thus we are planning to change the BOM Masterdata as below.
    BOM Header Material--- ABC
    BOM Components---- ABC2 , ABC3, ABC4,ABC5,
    Because of the change in BOM master data all the new contracts created will have the new BOM and its components.
    Our concern is how to convert the existing contracts. Business is asking even for the existing contracts if a sales order is created it should contain the new materials and taxes should be calculated based on the new materials.
    For the Legacy (Existing) contracts as few sales orders and invoices are created, we can not delete the old materials and add new materials.
    Is there any way to make the BOM Re explosion at sales order level .
    Ex: Conract created with old bom data and it has ABC and ABC1 materials in it, when a sales order is created system should read the new bom master data and explode it with the new materials.
    If we do it either through SAP Standard feature or by a user exit will there be any negative impacts on the existing transactions or will there be any problems as the materials in the contracts and sales orders will be different.
    Please share your thoughts and inputs on this.
    Thanks,
    Srini

    Hi All,
      When we ran the test cases the BOM is not Re-exploded in the sales order when created with referance to a contract. One  option we thought about is cancelling all the open contracts and creating new contracts for those, thus the new bom will be added to the contract. It looks very hectic as we have aroung 5000+ open contracts.
        Can any one suggest an alternative approach for this.
    Thanks,
    Srinivas
    Edited by: srini vasarao on Jun 27, 2011 9:02 AM

  • 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

Maybe you are looking for

  • How can i display image in mx:TextArea Component?

    I found display img tag in htmlText of mx:TextArea component is very difficult in Flex Air I new a simple air project in flex builder, put the code below in it, i put a glad.png file in the src folder, every thing is OK, when i run it, image cannot b

  • Sometimes having trouble shutting down

    Sometimes, lately, when I shut my computer down, it freezes on the last blue screen. After I choose "Shut down..." from the apple menu and choose "OK" the computer starts shutting down. Then my desktop icons go away, and USUALLY, I get a blue screen

  • How to attach any file in JSP

    Hi I am making a simple JSP web application. I want to have a text box along with an 'attach' button so that the user can upload any file from his machine. Any help about how to do that. Suleman

  • So confused with my 6700 slide

    Have just got a new 6700 slide and there are so many things I can't work out that I'm just about ready to throw it out the window! If anyone could answer any of these I'd be incredibly grateful. Ok: Firstly it keeps telling me it is unable to access

  • Photoshop elements 12, Apple Mac, What app do i need to get to open this document?

    Hi, i have just purchased photoshop elements 12, and it was nearly half way through when i had noticed it stopped. i clicked on my downloads and there was a blank looking document i clicked on it waiting for it to load, when it proceeded to tell me t