Updating a sales order through DI API

Hi All,
     I have an issue regarding updating a sales order.
The problem is:
  If there r 2 items(A00001&A00002) existed in the sales order and if I am adding two more items(A00003 & 4)the sales order is updated in a fashion that first item is replaced with third item and forth item is added as last record.The items to that particular sales order after updating will be like this(A00003,A00002,A00004).My doubt is why the 3rd item is replaced with first record.I am sending the code also i have written.
objRecordSet = SBOCOMUtil.newRecordset(company);
                      IDocuments  oOrder =SBOCOMUtil.newDocuments(company,SBOCOMConstants.BoObjectTypes_Document_oOrders);
                              objRecordSet.doQuery("select DocEntry from ORDR where DocNum=" + 1111);
                              DocEntryL =objRecordSet.getFields().item(new String("DocEntry")).getValueInteger().intValue();
                      str += DocEntryL;
                      System.out.println(DocEntryL);
                      if (oOrder.getByKey(new Integer(DocEntryL))) {
                              //objRecordSet2.doQuery("delete  from rdr1 where DocEntry="+DocEntryL);
                              str += "2";
                              System.out.println(str);
                              //oOrder.remove();
                              oOrder.setDiscountPercent(new Double(5));
                              oOrder.setComments("success");
                              System.out.println(str);
                              IDocument_Lines oOrderLines = oOrder.getLines();
                              str += "3";
                              String[] item={"A00005","A00006"};
                              for (int counter = 0; counter < item.length; counter++) {
                                   //  oOrderLines.setCurrentLine(new Integer(counter));
                                     if (counter > 0)
                                             oOrder.getLines().add();
                                     str += "4";
                              oOrderLines.setItemCode(item[counter]);
                              System.out.println(item[counter]);
                                 //oOrderLines.setBaseType(new Integer(-1));
                                 //oOrderLines.setBaseEntry(new Integer(0));
                               //oOrder.getLines().setCurrentLine(new Integer(counter));
                           //oOrderLines.setQuantity(new Double(1));
                                     //oOrderLines.setPrice(new Double(1500));
                                     //oOrderLines.setCurrency(strCurrency[counter]);
                                     //oOrderLines.setLineTotal(new Double(dblLineTotal[counter]));
                              str += "5";
                              //oOrder.getLines().getUserFields().getFields().item("Quantity").setValue(new Integer(2));
                              System.out.println(str);
                              int result = oOrder.update();
                              str += "6" + result;
                              if (result == 0) {
                                     System.out.println("successfully updated");
                                     company.disconnect();
                              } else {
                                     company.getLastErrorDescription();
                                     System.out.println(
                                             "Error :" + company.getLastErrorDescription());
                                     company.disconnect();

If you are using SBP 2004 there are many threads on this forum talking about bugs when updating sales order lines through DI API. This issue was supposed to be fixed with patch level 45 for 2004 which was recently released.
If u are using 2005 or SP1 I think you may have found a new bug.

Similar Messages

  • Problem In Creating Sales Order Through DI API

    Hi
    I am Creating The Sales Order Through DI API.
    the Error Is Coming - " [OACT] , 'No matching records found (ODBC -2028)'"
    anyone  can help me solving it.

    Hi vivek,
    Have you tried adding the same document with the client ?
    OACT is the accounts table and this error message typically indicates that there is an account parameter missing somewhere in the system.
    Possible causes include:
    - you are using a tax group or warehouse which does not have all the required accounts set
    - There is a price rounding and the rounding price account has not been set in the account settings
    - etc.
    The first things I would check include the tax group settings and the G/L Account determination settings.
    Henry

  • Create Sales Order through OE_ORDER_PUB  API and get credit card authorizat

    Hi,
    I was trying to know if there is some way to get credit card authorization (when payment type is CREDIT CARD) creating a Sales Order through de OE_ORDER_PUB API.
    I need to reproduce the manual process where you get this authorization, through the Action Button, in the Sales Order Window.
    Thanks in Advance.
    Nicolas.

    Hi Nagamohan,
    Thanks for the reply..It was Vision Instance that i was working on..
    There was some problem in setups. I had run the same script on other instance and it is working.
    Before signing off i have one more doubt...
    The script which i used is creating a sales order with booked_flag='Y' but flow_status_code is still 'ENTERED'
    how can i change it to 'BOOKED' using API...
    Thanks for the help...

  • SDK-DI - Add purchase order based on sales order through DI-API

    Today it is only possible to add a purchase order based on a sales order though the UI. This option should also be supported in the DI-API.

    hi,
    try removing the double quotes for basetype, baseline, baseentry.
    if it doesn't solve the problem
    make sure that you are assigning the docentry only but not the docnum of the sales order to the purchase order lines' baseentry.
    rgds,laks.

  • Error while updating the sales order through Process Order API

    Hi,
    Please any one will help plz.
    I am updating the promise_date through oe_order_pub.process_order(Process Order API) i am getting the following error.
    FND_AS_UNEXPECTED_ERROR N PKG_NAME OE_Order_Cache N PROCEDURE_NAME get_tax_calculation_flag N ERROR_TEXT ORA-01403:no data found
    Please any one will help plz
    Below is my code.
    Declare      
    l_archive_file_name VARCHAR2(1000);
    l_shipment_exists NUMBER:=0;
    l_header_id NUMBER;
    l_line_id NUMBER;
    p_header_rec Oe_Order_Pub.Header_Rec_Type;
    l_line_tbl oe_order_pub.line_tbl_type := oe_order_pub.g_miss_line_tbl;
    l_header_rec OE_ORDER_PUB.Header_Rec_Type;
    l_header_val_out_rec OE_ORDER_PUB.Header_Val_Rec_Type;
    l_header_adj_out_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
    l_header_adj_val_out_tbl OE_Order_PUB.Header_Adj_Val_Tbl_Type;
    l_header_price_att_out_tbl OE_ORDER_PUB.Header_Price_Att_Tbl_Type;
    l_header_adj_att_out_tbl OE_ORDER_PUB.Header_Adj_Att_Tbl_Type;
    l_header_adj_assoc_out_tbl OE_ORDER_PUB.Header_Adj_Assoc_Tbl_Type;
    l_header_scredit_out_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
    l_header_scredit_val_out_tbl OE_Order_PUB.Header_Scredit_Val_Tbl_Type;
    l_line_rec OE_ORDER_PUB.line_rec_type;
    l_line_out_tbl OE_ORDER_PUB.Line_Tbl_Type;
    l_line_val_out_tbl OE_ORDER_PUB.Line_Val_Tbl_Type;
    l_line_adj_out_tbl OE_ORDER_PUB.Line_Adj_Tbl_Type;
    l_line_adj_val_out_tbl OE_ORDER_PUB.Line_Adj_Val_Tbl_Type;
    l_line_price_att_out_tbl OE_ORDER_PUB.Line_Price_Att_Tbl_Type;
    l_line_adj_att_out_tbl OE_ORDER_PUB.Line_Adj_Att_Tbl_Type;
    l_line_adj_assoc_out_tbl OE_ORDER_PUB.Line_Adj_Assoc_Tbl_Type;
    l_line_scredit_out_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
    l_line_scredit_val_out_tbl OE_Order_PUB.Line_Scredit_Val_Tbl_Type;
    l_lot_serial_out_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
    l_lot_serial_val_out_tbl OE_Order_PUB.Lot_Serial_Val_Tbl_Type;
    l_action_request_out_tbl OE_Order_PUB.Request_Tbl_Type;
    l_msg_count NUMBER;
    l_msg_data VARCHAR2(2000);
    l_return_status VARCHAR2(1);
    l_index NUMBER;
    l_rows_processed NUMBER:=0;
    l_line_mawb VARCHAR2(240);
    l_line_hawb VARCHAR2(240);
    l_line_flight_num VARCHAR2(240);
    l_org_id NUMBER :=143;--FND_GLOBAL.ORG_ID;
    l_resp_id NUMBER:=FND_GLOBAL.RESP_ID;
    l_resp_appl_id NUMBER:=FND_GLOBAL.RESP_APPL_ID;
    l_user_id number := FND_GLOBAL.USER_ID;
    l_promise_date date;
    BEGIN
    SELECT ol.org_id, oh.header_id, ol.line_id,ol.promise_date
    INTO l_org_id, l_header_id, l_line_id,l_promise_date
    FROM apps.oe_order_headers_all oh, apps.oe_order_lines_all ol
    WHERE ol.header_id=oh.header_id
    AND ol.line_id =1319526; --&line_id
    -- apps.fnd_global.apps_initialize(&l_USER_ID,&l_resp_id,&l_resp_appl_id);
    apps.fnd_global.apps_initialize(67778,51017,660);
    p_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    p_header_rec.header_id :=835035;-- l_header_id;
    p_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
    l_line_tbl := oe_order_pub.g_miss_line_tbl;
    -------------------------Line Record -------------------------------
    l_line_tbl(1) := oe_order_pub.g_miss_line_rec;
    l_line_tbl(1).header_id := 835035;
    l_line_tbl(1).line_id := 1319526;
    l_line_tbl(1).promise_date := sysdate;
    l_line_tbl(1).operation := oe_globals.g_opr_update;
    BEGIN
    apps.oe_order_pub.process_order
    (p_api_version_number => 1.0
    ,p_init_msg_list => fnd_api.g_true
    ,p_return_values => fnd_api.g_true
    ,x_return_status => l_return_status
    ,x_msg_count => l_msg_count
    ,x_msg_data => l_msg_data
    ,p_header_rec => p_header_rec
    ,p_line_tbl => l_line_tbl
    -- out variables
    ,x_header_rec => l_header_rec
    ,x_header_val_rec => l_header_val_out_rec
    ,x_header_adj_tbl => l_header_adj_out_tbl
    ,x_header_adj_val_tbl => l_header_adj_val_out_tbl
    ,x_header_price_att_tbl => l_header_price_att_out_tbl
    ,x_header_adj_att_tbl => l_header_adj_att_out_tbl
    ,x_header_adj_assoc_tbl => l_header_adj_assoc_out_tbl
    ,x_header_scredit_tbl => l_header_scredit_out_tbl
    ,x_header_scredit_val_tbl => l_header_scredit_val_out_tbl
    ,x_line_tbl => l_line_out_tbl
    ,x_line_val_tbl => l_line_val_out_tbl
    ,x_line_adj_tbl => l_line_adj_out_tbl
    ,x_line_adj_val_tbl => l_line_adj_val_out_tbl
    ,x_line_price_att_tbl => l_line_price_att_out_tbl
    ,x_line_adj_att_tbl => l_line_adj_att_out_tbl
    ,x_line_adj_assoc_tbl => l_line_adj_assoc_out_tbl
    ,x_line_scredit_tbl => l_line_scredit_out_tbl
    ,x_line_scredit_val_tbl => l_line_scredit_val_out_tbl
    ,x_lot_serial_tbl => l_lot_serial_out_tbl
    ,x_lot_serial_val_tbl => l_lot_serial_val_out_tbl
    ,x_action_request_tbl => l_action_request_out_tbl
    --dbms_output.put_line('l_msg_data-->' ||l_msg_data ||' l_return_status --> ' ||l_return_status);  
    END;
    commit;
    END;
    Regards,
    Sangu

    Hi Sangu,
    See if the following notes help you:
    Error when calling API from SQL*Developer, eg. ORA-01403 in API OE_ORDER_PUB.PROCESS_ORDER (Doc ID 1054295.1)
    Cancellation Of Transfer Orders Is Not Possible - ORA-01403: no data found in Package OE_Order_PVT Procedure Process_Order (Doc ID 391307.1)
    Thanks &
    Best Regards,

  • Adding Sales BOM to Sales Order through SDK

    Hello Experts,
    We're encountering an issue with adding Sales BOM items to the Sales Order through the SDK. When we add the parent, the object automatically adds the children as lines after all other lines. This causes issues with our batch delivery creation. When the Sales Order is created inside SBO Client, it always adds the child items right under the parent. We have a work around where we change the LineNum through SQL, but that seems like a sketchy method - what's the proper way of adding Sales BOM items to a Sales Order?
    Here is the code we're using to add the Sales Order lines
    olOrders.Lines.ItemCode = sItemCode
    olOrders.Lines.ItemDescription = aRecSet.Fields.Item("name").Value
    olOrders.Lines.UnitPrice = aRecSet.Fields.Item("cartprice").Value
    olOrders.Lines.Quantity = aRecSet.Fields.Item("qty").Value
    Thanks for the help!

    Hi Rob,
    I certainly wouldn't recommend you use a direct SQL command to update the LineNum on the sales order rows. This will invalidate your support agreement with SAP.
    One way you can deal with this would be to add your Sales BOM header item to a draft document (of type sales order) and add this first. You can then retrieve it in the DI API and add the other Items before adding the document as a proper sales order (and removing the draft). You can do this using the Draft and Documents objects either by coding each property or by exporting the Draft to XML and using XLST to convert it to a Sales Order and reimporting it. It does require a fair bit of coding but it will achieve what you need.
    Kind Regards,
    Owen

  • Dates fields issue in the sales orders through IDOC

    Hi all,
    I'm trying to create a sales order through Inbound IDOC using IDOC_INPUT_ORDERS.
    I have 2 custom fields in the sales order which are date fields.
    I'm populating them from the IDOC segments(using E1EDKT1-tdid, E1EDKT2-tdline) in the user-exit just before the call trasacation statement. These dates are not coming for a few orders... but are getting populated normally for few of them.
    But the tricky part is that... if I process the same IDOC for the second time.. the order created is having the dates.
    My issue is that.. i need all the orders to be populated with the dates which IDOC have.
    Could anyone please help me with this issue.
    All the answers/replies are highly appreciated!!
    Thanks for you help!

    hi,
    the following may be of help
    There are 2 major exceptions to the batch input internal table. All text data from the segments E1EDKT1/2 and E1EDPT1/2 are not part of the batch input session. Text elements from these segments are posted directly to the data base AFTER the sales order has been created (please note: in order that item texts are posted correctly to the sales order the field POSEX from segment E1EDP01 MUST be transmitted). Also, configurable material information from the IDOC is exported to a global memory and therefore will not be part of the batch input session. Configurable material data is performed in Form CHECK_CONFIGURATION and the data is exported to global memory in the following code:
    Exportiert IDOC Daten ins globale Memory     
    export IDOC data to global memory            
      call function 'CUXC_IDOC_TO_MEMORY'          
           tables                                  
                cfg_instref = xe1curef             
                cfg_ref     = xe1cucfg             
                inst        = xe1cuins             
                part_of     = xe1cuprt             
                value       = xe1cuval             
           exceptions                              
                error       = 1                    
                others      = 2.                   
    One extra piece of useful infomartion if you wish to debug the process is to set your breakpoints at the following points
    for Function module IDOC_INPUT_ORDERS
    include LVEDAF0F..
      CALL TRANSACTION 'VA01' USING bdcdata
                                MODE  input_method
                                UPDATE 'S'
                                MESSAGES INTO xbdcmsgcoll.
    Now input_method is A foreground process and N for background processing but try changing it to P (pass through mode)
    If you have breakpoints in va01, e.g. MV45AF0B_BELEG_SICHERN,(the part where the sales document is saved)
    they will be hit, e.g
    perform userexit_save_document_prepare.
    perform userexit_save_document.
    Lastly, don't forget using program SDJEDI , see note 380603 for more information on this
    Hope this is useful
    Paul Quinn

  • When I create Return Sales Order through BDC sales order doesnu2019t create.

    Deal Guru,
    When I create Return Sales Order through BDC sales order doesnu2019t create.
    It shows created sales document number but when I display this document I am getting message Document is not in database.
    After executing my BDC, message received in SAP in box : SAPSQL_ARRAY_INSERT_DUPREC
    I am receiving following message in SAP inbox for following issue.
    But when I create Return Sales Order through VA01, it is working. Please give me some idea.
    Detail Message
    Update was terminated
    System ID....   PRO
    Client.......   900
    User.....   DEVELOPER2
    Transaction..   VA01
    Update key...   4961DBF46A6B09D2E10080020A02281C
    Generated....   05.01.2009, 16:03:40
    Completed....   05.01.2009, 16:03:40
    Error Info...   00 671: ABAP/4 processor: SAPSQL_ARRAY_INSERT_DUPREC
    Regards
    Makarand

    Hi Rory
      Try this link:
       BAPI can't to create SO,But used bapi data with manual can?
    Regards
    Neha

  • Disallow changes in Sales Order through T-Code VA02

    Dear Gurus,
    We create the Sales Order and with reference to that the User wants to change few fields (Account Assignment Group, Pricing Date, Invoice Date, INCO terms, Payment Terms etc.) which are not supposed to be edited by him through T-Code VA02. Changes should also not to be made with regard to Material Line Item Material like Description & Quantity in Sales Order. We have tried to do the same through Transaction Variant (T-Code SHD0 & User Exit). Unfortunately it is not working. We are not able to assign the Transaction Varient for T-Code VA02 in sales document type through VOV8.
    System Audit has raised these points and needs to be done at the earliest.

    Hello Aaheli,
    I think your requirement of restricting the modification of Sales Order through VA02 can be meet using the following approach:
    Seek out the help of BASIS to restrict the Sales order modification role for that specific User ID.
    If you wanna restrict the modification of Sales order through VA02 for amny User ID then please use User exit.
    Do inform us about the latest updates on this issue.
    Regards,
    Sarthak

  • Import of Sales Order through DTW

    Dear All
    I am having problems in importing Sales Orders through DTW. I have used the template 'oOrders' and enter the required data in the 'Document' and 'Document-Lines' files.
    When, I run the DTW and uploaded the Sales Orders, it was imported successfully. But when I search in SBO, no Sales Order was created.
    I have also, unchecked the box 'Test Run', but still it doesnot posted any Sales Order.
    Kindly, help me in this regards
    Thanks and Best Regards
    Nabeel

    Dear Gordon
    Thanks for your prompt response.
    In the 'Documents' template, I filled the following columns:
    RecordKey   CardCode            DocDate       DocDueDate  
    1                  AAJ-KAC-6         20081203      20081203
    In the 'Documents-Lines' template, I filled following columns:
    RecordKey    ItemCode                 DocDate       DocDueDate     Price   Quantity   Tax Code
    1                  701-0020-0000         20081203      20081203         10        10            X0
    I, also tried to post the Sales Order manually by entering the above data and SO was posted. But it is not posting through DTW.
    Thanks and Best Regards
    Nabeel

  • Creation of Sales orders through EDI

    Hello,
    We have a problem when creating sales orders through EDI.
    We are getting IDOCs with a delay of 1 second.Before  
    creating sales orders through the posting function
    module IDOC_INPUT_ORDERS, we need to validate for
    reference Purchase order number in the IDOC. If there is
    any sales order in the database with the Purchase order
    number in the current IDOC that sales order should be 
    blocked.
    We already put a validation in the User-Exit of the
    posting function module. Because of the frequency of
    IDOCs we receive, this validation is getting failed.
    Can anybody tell me, how to process only 1 IDOC at any
    given point of time before the Posting process.
    Thanks,
    Madhusudan.

    Hi Sanjeev,
      Thank you very much for helping me out in this problem.Still I haven't got the solution.
    I tested the above mentioned configuration option by putting the Check Purchase Order Number field to 'A' in the transaction VOV8. But while creating sales orders, it is giving only information message. Is there any other way, to restrict the Duplicate PO value through configuration setup.
      can you also explain how to use Enqueue and Dequeue FMs in the inbound posting function module.
    Regards,
    Madhusudan.
    Message was edited by: Madhusudan Budati
    Message was edited by: Madhusudan Budati

  • Error while creating Sales Order Through BAPI

    Hi Friends,
      i am creating a RFC where i have to create sales order .
    I am using bapi
    BAPI_SALESORDER_CREATEFROMDAT2
    for same and entering values to it.
    I got the following return messages:
    S V4                   233 SALES_HEADER_IN has been processed successfully
    S V4                   233 SALES_ITEM_IN has been processed successfully
    S V1                   311 BDN Order 3112800903 has been saved
    But when I go to transaction VA03 and enter the number i get the following error:
    SD document 3112800903 is not in the database or has been archived
    Can any one know how to resolve this error.I am also using BAPI_TRANSACTION_COMMIT with wait = 'X'.
    Regards,
    Santosh Alle

    Hi,
    Try to check the return message once.
    SD document 3112800903 is not in the database or has been archived
    You will get this message if the sales document is deleted from the database .The BAPI   'BAPI_SALESORDER_CHANGE'  is used to delete salesorder.Check whether anyone has deleted it
    Also, sometimes it may take few seconds to update the sales order in the database when using BAPI. Check the transaction after some time.
    Regards,
    Lakshman.
    Edited by: Lakshman N on May 14, 2010 7:43 AM

  • Creation of Sales Order through EDI

    Hi
    Can anybody explain in detail the configuration steps involved in creating the sales order through EDI. If possible with screen shots.
    Points will be rewarded.
    Thanking you
    chan

    Hi Hari & Siva,
    Could you please send the document to my mail id
    [email protected]
    Thanks in advance
    MMVD

  • Reg : NO UPDATE OF SALES ORDER FROM PO erroer I0 114

    hi experts,
    while creation of PO with reference to PR,user gets error " NO UPDATE OF SALES ORDER FROM PO erroer I0 114 ".
    What could be the reason for this error?any idea...
    rgrds...

    Hello Jurgen,
    here the error message is " NO UPDATE OF SALES ORDER FROM PURCHASE ORDER  error I0 114 " .
    is there any solution for this issue.user looks frustrated because its working for one PO and the next PO its showing error.
    Rgrds.....

  • No update of sales order from purchase order

    Hi,
    When I am trying to change the delivery date of a purchase order line item, I get the error
    "No update of sales order xxxxx from purchase order (error V1 348)" How can I resolve this?
    Sincerely,
    Ketan

    Hi,
    Check whether this PO is created w.r.t. PR and PR is created automatically during Sales order creation.
    If it is so then need no to change the delivery date in PO, it will always get updated as per the Schedule Line date of sales order.
    You can go for GR w.r.t. PO directly.

Maybe you are looking for

  • .mov file does not display on the web-site

    iWeb is easy to use but my simply link to a .mov file does not work. I am working on the Domain file on my Desktop so I can move it between computers, and it renames the media file in the inspector from name.mov to name-1.mov. In the end the site doe

  • Please help to use my class in a JSP

    Hi Please could someone help me i've started a new job and need to create like a "Add to shortlist" functionality to their website. I have created a class to create a cookie using the offerid specific to that page which is done in the doGet() method.

  • [svn:bz-4.6_Apache] 24056: Added changelog for donation to Apache.

    Revision: 24056 Revision: 24056 Author:   [email protected] Date:     2013-05-28 03:31:12 -0700 (Tue, 28 May 2013) Log Message: Added changelog for donation to Apache. Modified Paths:     blazeds/branches/4.6_Apache/modules/proxy/src/flex/messaging/s

  • How to upgrade e50 firmware via apple mac?

    I own an E50 (RM-170) which is currently running v 06.41.3.0. How do I tell what the most up-to-date firmware is? And how do I upgrade the firmware into the phone using an Apple Mac? (I saw the updater software for Windows but couldn't see a Mac vers

  • Error in billing header condition

    Hi Friends Greetings. In the header data condition of ZMRP & ZABT is being shown twice at the time of display of billing document using transaction code vf01 and vf02  which should be shown only once.. Please help me to solve this problem. With regar