Problem when creating a sales order with reference by BAPI

I am facing one problem when creating Sales Order.
<b>The scenario is like this while creating SO With reference to an Order type, a new SO will be automatically created with a diff order Type</b>.
I am using "BAPI_SALESORDER_CREATEFROMDAT2".
I am calling this BAPI in USEREXIT_REFRESH_DOCUMENT.
Am I using the right exit to call this Bapi ?
<b>Problems are like :
1. Ref Sales Order creating without Sales Unit .
2. "Object Status does not exist" error msg is coming for Header and Item level(when clicking the status tab and then object status pushbutton).</b> But if testing the bapi from SE37 in test sequence....no such problem persists.
As for example in case of sales unit,in the debugging mode i have seen that BAPI uses a perform to fill the values in the VBAP structure.But after that when it come back to the main program VBAP remains blank.This ocuurs when the BAPI is called from the exit whereas  if tested from SE37, VBAP retains the value.
Can u suggest in this ? This is very very urgent............
Thx in Adv.........................

Thanks........
Your suggestion was a great help to me.I have used a custom FM and called it in <b>starting new task</b>.
Since i am a university fresher working in SAP for nearly 1 year.....can you please explain me the difference between <b>in update task</b> and <b>starting new task</b>.Why the problem was occuring for which you have suggested to call a custom function module.
what is V1 update and V2 update?Is it attached with asynchronous ans synchronous update.It would be a great help to me if you kindly clear my confusions....
thanks in advance.

Similar Messages

  • Create sales order with reference via BAPI

    Hi all,
    I would like to know if is it possible to create a sales order with reference using BAPI, that is, I want to create an order from a contract, for example, referencing one or more contract itens. If so, what variable or table should I use?
    I think that the most suitable function is
    'BAPI_SALESORDER_CREATEFROMDAT2' or should I use another to do this?
    I am using release SAP ECC 6.0.
    Thanks for any help.
    Paulo

    yes, you are using right BAPI i.e. BAPI_SALESORDER_CREATEFROMDAT2
    You will have to provide ORDER_HEADER_IN in that, Others are optional, even then if you have data for them, Provide it for better performance.
    For any confusion related to chosing BAPI :  You may go to BAPI  transaction and find out the correct BAPI according to ur need. for example sales order relatd BAPI's are
    BAPI_SALESORDER_CHANGE :Change Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2: Create Sales Order
    BAPI_SALESDOCU_CREATEWITHDIA: Create Data Container with Dialog
    BAPI_SALESORDER_GETLIST:List of all Orders for Customer
    and so on.
    Reward if helpful..

  • Doubt in creating a sales order with reference to contract

    Hi all,
    when I create the sales order with reference to contract, in the table VBFA, the field PLMIN is set to zero some times and set to '+' some times. May I know whats the functionality behind this. Any pointers on this will be helpful.
    Regards,
    A.Rathinaprakash

    Hello A.Rathinaprakash,
    This is an Indicator which indicates the quantity or value in the target document(means Sales order) has a negative effect, positive effect, or no effect at all on the quantity still to be completed in the source document(means contract).
    Example from the Help file..
    In sales documents, for example, you can expect the following results:
    Quotation   -> Sales order: positive effect
    Contract    -> Return: negative effect
    Sales order -> Sales order: no effect
    In billing documents, for example, you can expect the following results:
    Delivery    -> Invoice: positive effect
    Delivery    -> Cancellation: negative effect
    Delivery    -> Pro-forma invoice: no effect
    Hope it helps..
    Regards,
    HP

  • Do not change the payment term created a Sales Order with reference

    Hi Gurus,
    Do not change the payment term created a Sales Order with reference to a contract where the payer of the change in Sales Order.

    Hello ,
    As per my understanding , you do not want the payment terms to be changed even if the payer partner function is changed ,
    as standard sap redetermines the payment terms with change in partner function, you may use the exit
    USEREXIT_MOVE_FIELD_TO_VBAK- header level
    USEREXIT_MOVE_FIELD_TO_VBAP- Item level
    in this you could write a small code which will not change the payment terms when payer is redetermined
    hope this helps
    Thanks
    akasha

  • 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

  • EDI: creating a sales order with reference to contract

    Dear gurus,
    we would like to create a sales order with reference to a SD contract from an ORDERS IDoc.
    OSS say we have to populate the E1EDx02 segments with the contract number to do this.
    We tested this in our system by manually editing the incoming IDoc and this is what we found:
    - qualifier u201C005  : Customer Contract Numberu201D set and BELNR = u201Cthe customeru2019s outline agreement number in his MMu201D (= normal MM behaviour) -> reference is not processed at all, sales order is created without reference
    - qualifier u201C043: Vendor Contract Numberu201D set and BELNR = our contract number in SD -> Sales order successfully created. BUT where can I store an external outline agreement number in MM so that the BELNR in the IDoc is populated with it?
    - qualifier u201C058: Customer Contract Numberu201D set and BELNR = the customeru2019s outline agreement number in his MM -> Error:
    The system could not determine a contract number
    Message no. VG226
    Diagnosis
    The system could not determine a contract number for the selection criteria: external contract number 5100000020 and customer number 0044000004.
    This error appears although we maintained the external number 5100000020 in the PO number field (VBKD-BSTKD) in our SD contract.
    Could anyone please explain what we do wrong?
    Cheers
    Alicia

    Hi again,
    @Lakshmipathi: Thank you, but it is VG226, like I wrote. But still, the OSS note is interesting: "You create a sales order with reference to an MM contract using EDI." Where's the sense in that? Why would I ever want to create a sales order with reference to an outline agreement in MM???
    @Rags: Sure we could do that, but I find it hard to believe that there is no standard way to do this. Especially given there are plenty of OSS notes stating that this is possible, e.g. note 562710.
    Any other ideas?
    Cheers
    Alicia

  • Create a Sales order with reference to another sales order  using BAPI

    Dear All,
    Can any one tell me what are all the parameters required to create a Sales order with reference to another sales order using BAPI_SALESORDER_CREATEFROMDAT2....
    Thanks in advance

    Hi Madhan
    Thanks a lot for your reply.
    However, I would like to know which parameters need to passed in this BAPI in case of SO creation with reference. I beleive there are only a few parameters that need to passed in ORDER_HEADER_IN, ORDER_ITEMS_IN, etc.
    Need to know exactly which are these parameters.
    Regards
    Mihir Shah.

  • How can I create a sales order with reference to a purchase order?

    How can I create a sales order with reference to a purchase order?
    Thanks in advance...

    Hello,
    you can't create a sales order with reference to a purchase order. You can input customer PO nuber in the sales order Purchase Order number filed.
    Prase.

  • Creating a sales order with reference/BAPI_SALESDOCUMENT_COPY

    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

    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.

  • Problem with BOM Quant while creating Sales order with reference using BAPI

    Dear All,
    I am facing problem with creating a slaes order with reference to other sales order by using BAPI_SALESORDER_CREATEFROMDAT2 .
    Sales order is getting created but
    1. It exploding the BOM means the line items which are not there in the reference SO also coming in the new SO ( all BOM items are coming )
    2. Schedule line for BOM header item is getting copied to all sub items of BOM.
    Can any one help me out to prevent the above deviations in creating Sales order with reference by using BAPI_SALESORDER_CREATEFROMDAT2.
    Note: while passing the parameters to BAPI_SALESORDER_CREATEFROMDAT2
    all the data related to items is exactly the same as in the original Sales Order.
    Thanks in advnace.
    Regards,
    John

    Hi All,
    Can any one help me !!!!!!!!!!
    please

  • 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

  • Creating ERP Sales order with reference to CRM Service Order

    Hello all,
    I am trying to create an ERP Sales Order from CRM. If Icreate the Sales Order manually, it is working correctly but, if I try to create the ERP Sales Order as follow-up document for the CRM Service Order, it is not working.
    I have defined the Cross-system Copying of Transaction Types, byt the ERP sales order is not shown as possible follow.up doc from the CRM Service Order. Does anyone know if it is possible?
    Additionally, I would need to create CRM Sales Orders in reference to ERP Sales Order. Is there any way to do it??
    Thanks in advance and Regards,

    Hi Oliver,
    Rajendra answer is correct.
    The SAP Standard integration Scenario creates a ERP sales order for all the salesitems in the serviceorder.
    Without items no salesorder is created in standard.
    Maybe you could realize your requirement with own coding when you save a new service order or by button - click.
    I realized something similar some weeks ago. One hind:  It is helpfull to maintain a ztable where you store which CRM serviceorder is linked to which sales orders.
    Kind regards.
    Manfred

  • Create a sales order with reference to another one. (BAPI)

    Hi everybody,
    I'm trying to create a new sales order with reference to another one (That's important because of the documents flow).
    I'm using 'BAPI_SALESORDER_CREATEFROMDAT2' but I couldn´t do it yet. I've read some ideas about this kind of creation in this forum; but I still haven´t found the solution yet.
    Some ideas about the BAPI parameters I nedd to complete?
    Thanks in advance!!

    Hi,
    Go through this one
    *& Report ZSD_R_SALESORDER
    report zsd_r_salesorder1 line-size 132 message-id zmmbapi .
    *& Created By : shailaja
    *& Created on : 13.10.2007
    *& Requested By : vardhman
    *& Description of program :
    Internal table definition *
    data: gt_order_header_in like bapisdhead occurs 0 with header line,
    gt_return like bapireturn1 occurs 0 with header line, " Return Messages
    gt_order_items_in like bapiitemin occurs 0 with header line, " Item Data
    gt_salesdocument like bapivbeln-vbeln , "Number of Generated Document
    gt_order_partners like bapiparnr occurs 0 with header line, "Document Partner
    gt_return1 like bapiret2 occurs 0 with header line.
    Data definition *
    types: begin of ty_gt_ft_sales ,
    partn_numb(10) type n ,"Customer Number 1
    partn_role(2) ,"Partner function
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    material(18), "MATERIAL
    targetquantity(020),"Target quantity
    reqqty(020), "Req quantity
    reqdate(010), "req date
    *REQ_DATE_H(010),
    ref_1(012), "Ref
    unload_pt(025),
    *PARTN_ROLE(2) ,"Partner function
    *PARTN_NUMB(10) ,"Customer Number 1
    end of ty_gt_ft_sales,
    begin of ty_header ,
    partn_numb(10) ,"Customer Number 1
    partn_role(2) ,"Partner function
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    unload_pt(025),
    req_date_h(010),
    end of ty_header,
    begin of ty_item,
    material(18), "MATERIAL
    targetquantity(020),"Target quantity
    reqqty(020), "Req quantity
    reqdate(010), "req date
    ref_1(012), "Ref
    *UNLOAD(025),
    end of ty_item.
    data : msg(240) type c, " Return Message
    e_rec(8) type c, " Error Records Counter
    rec_no(8) type c, " Records Number Indicator
    s_rec(8) type c, " Successful Records Counter
    t_rec(8) type c, " Total Records Counter
    v_matnr like mara-matnr,
    v_parvw type parvw.
    data : gt_ft_sales type standard table of ty_gt_ft_sales with header line.
    data : wa_gt_ft_sales type ty_gt_ft_sales,
    wa_order_items_in like gt_order_items_in,
    wa_gt_ft_sales1 type ty_gt_ft_sales,
    wa_header type ty_header,
    salesdocument like bapivbeln-vbeln.
    selection block for EXCEL UPLOAD FILE
    selection-screen begin of block b1 with frame title text-000.
    parameters file type ibipparms-path obligatory.
    selection-screen end of block b1.
    *<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
    at selection-screen on value-request for file .
    perform getname.
    form getname.
    call function 'F4_FILENAME'
    exporting
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    importing
    file_name = file.
    endform.
    *TOP-OF-PAGE.
    top-of-page.
    skip 3.
    format color col_heading inverse on.
    write 40 text-001.
    format color col_heading inverse off.
    skip 1.
    format color col_negative inverse on.
    write :/ text-002, 13 sy-mandt , 104 text-003, 121 sy-uname,
    / text-004, 13 sy-datum , 104 text-005, 121 sy-uzeit.
    format color col_negative inverse off.
    skip 3.
    *START-OF-SELECTION.
    start-of-selection.
    perform get_data.
    perform bapi.
    *end-of-page.
    perform result.
    form result.
    t_rec = e_rec + s_rec.
    skip 3.
    format color col_total inverse on.
    write: /38 text-007, t_rec.
    format color col_total inverse off.
    format color col_negative inverse on.
    write: /38 text-008, e_rec.
    format color col_negative inverse off.
    format color col_total inverse on.
    write: /38 text-009, s_rec.
    format color col_total inverse off.
    endform.
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    form get_data .
    call function 'WS_UPLOAD' "#EC *
    exporting
    filename = file
    filetype = 'DAT'
    tables
    data_tab = gt_ft_sales
    exceptions
    conversion_error = 1
    file_open_error = 2
    file_read_error = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    no_authority = 10
    others = 11.
    if sy-subrc 0 .
    message e000.
    endif.
    endform. " get_data
    *& Form BAPI
    form bapi .
    loop at gt_ft_sales into wa_gt_ft_sales.
    wa_gt_ft_sales1 = wa_gt_ft_sales.
    at new partn_numb.
    wa_header-doc_type = wa_gt_ft_sales1-doc_type..
    wa_header-sales_org = wa_gt_ft_sales1-sales_org . "'0001'
    wa_header-distr_chan = wa_gt_ft_sales1-distr_chan. "'01'
    wa_header-division = wa_gt_ft_sales1-division. " '01'
    wa_header-purch_no = wa_gt_ft_sales1-purch_no.
    wa_header-req_date_h = wa_gt_ft_sales1-reqdate.
    call function 'CONVERSION_EXIT_PARVW_INPUT'
    exporting
    input = wa_gt_ft_sales1-partn_role
    importing
    output = v_parvw.
    wa_header-partn_role = v_parvw.
    wa_header-partn_numb = wa_gt_ft_sales1-partn_numb.
    wa_header-unload_pt = wa_gt_ft_sales1-unload_pt.
    move-corresponding wa_header to gt_order_partners.
    move-corresponding wa_header to gt_order_header_in.
    append gt_order_header_in.
    append gt_order_partners.
    endat.
    call function 'CONVERSION_EXIT_CCMAT_INPUT'
    exporting
    input = wa_gt_ft_sales1-material
    importing
    output = v_matnr.
    gt_order_items_in-material = v_matnr .
    gt_order_items_in-target_qty = wa_gt_ft_sales1-targetquantity . "'1000'
    gt_order_items_in-req_qty = wa_gt_ft_sales1-reqqty.
    gt_order_items_in-req_date = wa_gt_ft_sales1-reqdate.
    *GT_ORDER_ITEMS_IN-BILL_DATE = wa_GT_FT_SALES1-REQDATE.
    gt_order_items_in-ref_1 = wa_gt_ft_sales1-ref_1.
    append gt_order_items_in.
    clear : wa_gt_ft_sales1,wa_header.
    at end of partn_numb.
    call function 'BAPI_SALESORDER_CREATEFROMDAT1'
    exporting
    order_header_in = gt_order_header_in
    WITHOUT_COMMIT = ' '
    CONVERT_PARVW_AUART = 'X'
    importing
    salesdocument = salesdocument
    SOLD_TO_PARTY =
    SHIP_TO_PARTY =
    BILLING_PARTY =
    return = gt_return
    tables
    order_items_in = gt_order_items_in
    order_partners = gt_order_partners.
    ORDER_ITEMS_OUT =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CCARD =
    ORDER_CFGS_BLOB =
    ORDER_SCHEDULE_EX =
    if gt_return-type eq 'E' .
    e_rec = e_rec + 1.
    read table gt_return with key id = 'V1'.
    format color col_negative inverse on.
    rec_no = e_rec + s_rec.
    concatenate text-006 rec_no ':'
    gt_return-message into msg separated by space .
    condense msg.
    write: / msg.
    format color col_negative inverse off.
    elseif gt_return-number = '000'.
    s_rec = s_rec + 1.
    format color col_positive inverse on.
    msg = 'SUCCESS'.
    condense msg.
    write: / msg .
    format color col_positive inverse off.
    write :/ salesdocument, 'Has been created'.
    perform commit_mm.
    endif.
    clear: gt_return[], msg.
    endat.
    endloop.
    endform. " SLALE_UPLOAD_DATA
    *& Form COMMIT_MM
    text
    --> p1 text
    <-- p2 text
    form commit_mm .
    call function 'BAPI_TRANSACTION_COMMIT'
    exporting
    wait = 'X'
    importing
    return = gt_return1.
    clear: gt_order_items_inhttp://].\"GT_ORDER_CONDITIONS_IN[.
    endform. " COMMIT_MM
    inthis pass re_doc field in header...
    Edited by: Naresh kumar

  • Creating new sale order with reference of old sale order.

    Dear gurus
    i have requirement
    i want to make a sale order with reference of old sale order.
    how to achieve it?
    Regards
    Saad Nisar

    Hi,
    In vtaa
    give source and document number and assign all the relevant routines.
    Now on the left hand side, click the Item button and then give the source I.C as TAC and target also as TAC adn then fill the routines.
    Do the same for Schedule line (which is related to TAC)
    If this is done, then ur scenario will work

  • Warning message, if Quantity=0, when creating a sales order with VA01orVA02

    Hi Experts,
    Currently, if the user do not enters any value in QUANTITY field, while creating a sales order(or even VA02 too) ..........we are getting a Warning message(VU001).
    So, I need to change it to hard error message type, am changing the message type, but, its not reflecting, and still its throwing a warning message(VU001)!!
    Let me know that, What is the correct user exit to incorporate my changes?
    From where this message generating? am keeping a watch point with this message (VU001), but, its not stopping!!
    System is ECC 6.0
    repliaes appreciated
    thanq
    Edited by: SAP ABAPer on Dec 22, 2008 4:38 PM

    thanq
    (the reason, why my original code was worked is that, I put my code in SAVE user exit!!)
    yes, its working, but, the scaenrio is different, so, its like,
    if the user entered my_matnr with quantity = 0,
    then presses ENTER,
    now, we are getting a WARNING MESSAGE of message class & # is VU001, saying the Item 000010 is quantity 0...........so, here I need to change it to HARD ERROR message.
    So, as soon as press the ENTER button(after enetring 0 qty matnr)........I need to get HARD error message, so, where should I incorporate the changes? is it MOVE FIELD TO VBAP user exit?
    thanq

Maybe you are looking for

  • Photoshop CS4 Extended will not open file from Bridge.

    This is 2nd time this has occurred.  Last time I uninstalled CS4 and re-installed to fix it.  Prefer to not do that again. System: XP Media center, SP3,  3 GB memory, Athlon 64x2.  Generic - motherboard graphic card.  18 GB disk space remaining. Typi

  • HT201303 Payment type

    I just update my ipad2, try to purchase an app and the system always ask me to verify my payment type. I did all of the information to verify my credit card info, but I cannot install the app because it keep ask me to verify payment type. Can you ple

  • What is usage of package interface?

    Hi Experts:                 Who knows what the usage of package interfce is? How to use it in development.

  • JNDI Protocol for Websphere MQ

    Hi, I am able to send/retrive messages to WebSphere MQ using filesystem-based implementation in simple java class. Now I want to send/retrive message from ODI JMS Queue technology. In Topology Manager, When I create Data Server for JMS Queue then JND

  • Syncing takes forever

    How much time I would expect if I sync two movies from my iMac into my ATV (with ~1.8 GB each movie)? I started to sync this 2 movies, have passed 5 hours and still around 40% done. It is working, not freezed.