Update Sales-Order

Hello,
I want to update an existing Sales-Order. I use a key-expansion to get the docentry of the salesorder I want to update, this part works perfect.
If I try to update the salesorder, I always recieve the following error:
com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: com.sap.b1i.bizprocessor.BizProcException: BPE001 Nested exception: com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: java.lang.RuntimeException: com.sap.b1i.adapter.dia.exception.InsertOnExistsException: The business object already exists
My write-policy for insert on exists is fallback2U.
I use B1iSN 2007 PL13, the SBO-system is 2007 A SP00 PL48.
Best regards,
Thomas Kneidl

Hi Thomas,
This error message clearly states the system is trying to create the record when it already exists.
One way to handle this is to modify your xml to use the query parameter to check if the document exist and the follow thro.
If it does not exist then create it
An example
<QueryParams>
<DocEntry>
<xsl:value-of select="BOM/BO/Documents/DocEntry"
</DocEntry>
</QueryParams>
You may have to define a variable for the DocEntry and use variable in the select
Hope this helps
regards
Anthony

Similar Messages

  • Update Sale Order Header Text through Enhancement

    Hi Experts,
             I Have a requirement to update the sale order Header Text , when the sale order is opened in VA02 and saved.
    Here in I tried using edit_text, it updates sale order header text  directly in DB during run time even before the save action is completed.
    But I need to just fill the header text and that has to be saved during the save action only.
    I tried coding the same in the user exit (userexit_save_document) but this user exit gets triggered only when there is some changes made to the document when opened in VA02 & Saved.
    Is there any  user exist to pass sale Order Header text and save when save button is clicked irrespective of the document been changed or not.
    Thanks in advance
    Sathish

    Hi Brad Bohn,
        My actual requirement is to trigger an Idoc when the user goes to VA02 transaction and clicks save.
    IDoc gets triggered only when there is some changes to that document, that is through NAST table entry based on the output configurations in NACE transaction.
    Now that the user wants to trigger an IDoc even if there is no change (ie. to reprocess the IDoc) when he just opens a sale order in VA02 and click save.
    It is not possible to trigger an IDoc through configurations when there is no actual change in VA02 and saved.
    So it has to be forcefully sent by making some additions to the Order through coding, so I choose that Text box to fill some additional data and save .
    Kindly Let me Know any thing could be done for this scenario.
    Thanks in advance
    Sathish

  • How to update sales orders using B1WS in SAP 8.8 PL18

    Hello all.
    We are having a problem updating sales orders using Sap Business One Web Service ( B1WS ).
    We are running SBO 8.8 PL18, MS-SQL 2008, and all is fine when using the SBO client.
    But when it comes to updating sales orders through B1WS we just cannot get it to work.
    We can add new orders easily without problems. Updating orders always gives this error:
    \[ORDR.PayDuMonth\]\[line: 0\] , 'Field cannot be updated (ODBC -1029)'
    We have checked and verified multiple times that our setup is correct.
    Also the WDSL files are verified.
    We can update orders just fine using the sboclient.
    And using B1WS we can basically do everything, besides updating.
    We have also tried this on different company db's, so we are quite sure this is not
    something related to some general setting we missed, but who knows?
    We have tried different ways to "assemble" the order before updating, but it always
    ends with the above error.
    Here is an example of one of the tests, where we load an order by docentry,
    increment the quantity of all open lines by '1', and then try to update it.
            protected void Page_Load(object sender, EventArgs e)
                // First we login
                string sessionId = "";
                LoginService.LoginService l_login = new LoginService.LoginService();
                LoginService.LoginDatabaseType l_dbtype = LoginService.LoginDatabaseType.dst_MSSQL2008;
                LoginService.LoginLanguage _lang = LoginService.LoginLanguage.ln_English;
                string _server = "SAP-8_8PL18";
                string _licserver = "SAP-8_8PL18:30000";
                string _db = "my_test_company";
                string _user = "manager";
                string _pass = "********";
                try
                    sessionId = l_login.Login(_server, _db, l_dbtype, true, _user, _pass,
                               _lang, true, _licserver);
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                if (sessionId == "")
                    Response.Clear();
                    Response.Write("No sessionId");
                    Response.End();
                // We are logged in and have a sessionId
                // Now load a valid open order by docentry
                try
                    OrdersServiceRef.OrdersService orderService = new OrdersServiceRef.OrdersService();
                    orderService.MsgHeaderValue = new OrdersServiceRef.MsgHeader();
                    orderService.MsgHeaderValue.SessionID = sessionId;
                    orderService.MsgHeaderValue.ServiceName = OrdersServiceRef.MsgHeaderServiceName.OrdersService;
                    orderService.MsgHeaderValue.ServiceNameSpecified = true;
                    OrdersServiceRef.DocumentParams docParams = new OrdersServiceRef.DocumentParams();
                    docParams.DocEntry = 31; // Docentry of a known open order
                    docParams.DocEntrySpecified = true;
                    OrdersServiceRef.Document order = orderService.GetByParams(docParams);
                    OrdersServiceRef.DocumentDocumentLine line = null;
                    for (int i = 0; i < order.DocumentLines.Length; i++)
                        line = order.DocumentLines<i>;
                        if (line.LineStatus == OrdersServiceRef.DocumentDocumentLineLineStatus.bost_Open)
                            line.Quantity += 1;
                    orderService.Update(order);
                catch (System.Web.Services.Protocols.SoapException ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                Response.Clear();
                Response.Write("All OK");
                Response.End();
    I hope that someone has an idea as to why this happens.
    The customer often changes quantity or adds lines on their orders,
    and the only way to solve it so far has been to make a new order and
    close the old one.
    Thanks in advance
    J. Thomsen

    Hi,
    Welcome you post on the forum.
    Have you checked if you only update a specific line instead of a loop?
    Thanks,
    Gordon

  • Error while updating Sales Order : Another user Modified Table (RDR1 )

    Hi All,
    I am getting an error message while running the following steps.
    Steps
    1)     Pull an entry from sales order.
    2)     Add new data to line.
    3)     Update the sales order.
    a)     Sap updated the data.
    b)     Through code using DI API we updated some UDF.
    4)     With out closing / Pressing OK button…
    5)     We added new data to line.
    6)     Then Press update.
    An Error will through by B1 as “Another user modified the table(RDR1 ).” Before going to the code where we are handling the update of UDF.
    But after the 3rd step above when we do
    4) Close the window or pressed ok
    5)  take the sales order window again pull the data
    6) Add new Data to line.
    7) Update sales order then it will go smoothly.(Updating by B1 and from code )
    Can anybody tell me why this happens?And any workarounds to solve this?
    Deepesh

    are u adding a matrix row thru the code? I get this error when I am adding rows and I get the rownumber out of sync.
    if so get the max (lineid) from rdr1 and then check against the matrix.rowcount before adding a row. if lineid is greater that matrix.rowcount take lineid + 1 and assign it to the matrix.row, else take the rowcount + 1
    if not, and as a workaround, then you can try using the SBO_SP_transactionnotification stored procedure.

  • Update sales order qty through BAPI_SALESORDER_CREATEFROMDAT2

    HI
    Can anybody help me out.  I have the requirement for creating sales order through BAPI_SALESORDER_CREATEFROMDAT2. The sales order is created but with 0 quantity.
    I am using fields RNDDLV_QTY and TARGET_QTY and REQ_QTY in schedule lines & also setting the update indicator to 'X'  in the corresponding itemx structures.
    In fact it used to work earlier and has stopped now. I am also checking if there could be any change in configuration but don't think this should be the reason.
    Can someone guide me as to which quantity fields of the BAPI are the right ones to update sales order qty?
    thanks

    Hi,
    You are using the correct fields i.e. TARGET_QTY and REQ_QTY. Just check if you are passing the same Item Number in both the tables.
    Hope it helps...
    Lokesh

  • Updating Sales Order Status in Batch

    Hi
    Please let me know if we can update Sales Order Line details like Ship To Address , Date , Status in a batch?
    We are using 11.5.10
    Thanks

    Use the Order management API or the OM interface tables.
    See irep.oracle.com for details.

  • Updating Sales Order no in Production Order

    we have csenario for Sales Order :  Inquery - Quotation - Sales Order .
    In PP we have MTO scenarion . when i run MRP and convert the plan order to Production Order , in place of Sales Order it was updatin Quotation in Production Order .
    we have checked SD config for sales doc Item category =TAC and in Material Master we will used Item Category = NORM
    Please suggest is there any other setting for updating Sales Order no in Production Order .
    Thnx.

    Hi,
    I assume that you are using the strategy 20 (MTO). Go to OVZG here select the class 040 Indiv.cust.w/o cons., keep BLANK for account assignment consumption and rerun the whole cycle and check.
    Thanks
    Hrishi

  • Updating Sales Order Retrospectively with PGI figure

    Hi
    Does anyone know if there is a way of retrospectively updating sales order with the value that has actually been POST GOODS ISSUED
    Thanks
    Tony

    What do you mean by Value? does the Value of the item change during PGI?
    If you mean to say, quantity, then yes, After PGI, go back to your order and change the order qty = PGI qty.
    Regards
    Sai

  • Error message when updating Sales Orders

    Hi Experts
    Following an issue over the weekend when I was forced to perform a  hard reset we are now experiencing error message when trying to update some sales orders. 
    This entry already exists in the following tables " ADO1 (ODBC - 2035) [Message 131 - 183]
    it is not happening on all orders - i think only ones which were on the system prior to the reset.
    We also use webtools and the B1SyncService seems to be causing the SAP B1 system to become unusable - following each attempt to sync there is an error in the event log:
    Event Type:     Error
    Event Source:     B1SynchService
    Event Category:     None
    Event ID:     0
    Date:          29/06/2009
    Time:          13:42:38
    User:          N/A
    Computer:     SQL01
    Description:
    A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
       at netpoint.api.data.DataFunctions.ExecuteScalar(String SQL, String connectionstring)
       at NetPoint.SynchSBO.SBOObjects.SBOUtility.SetCompany(Company TheCompany, SecurityTicket securityTicket)
       at NetPoint.SynchSBO.Synch.SetCompany()
       at NetPoint.SynchSBO.Synch..ctor(SecurityTicket ticket)
       at NetPoint.SynchSBO.Synch..ctor(SecurityTicket ticket, Int32 pricinginterval)
       at NetPoint.SynchService.NPSynchService.Synch(String profile, Mutex mutex)
       at NetPoint.SynchService.NPSynchService.Main(String[] args)
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    For now I have had to stop the SyncService to prevent B1 from becoming unusable (users are unable to start any AR module), but even after I have stopped the syncservice I still have the error when updating sales orders.
    Regards
    Jon

    Dear Johnny,
    the error reported sounds like a DB Corruption. I would advise you to log a message to SAP Support including all the details in order to obtain the error message. It is also a good idea and it will speed up the process if you include some print screens showing exactly the error message.
    Hope my reply helps you to solve the issue.
    Regards,
    Wesley Honorato

  • Function Module or BAPI to update Sale Order Quantity (VBAP-kwmeng)

    Hi,
    I have a requirement to use a Function Module or BAPI to update Sale Order Quantity (VBAP-kwmeng), which one (Function Module or BAPI) should I use? is there any sample codes?
    Thanks a lot!!

    Hi,
    *& Report  ZTEST
    REPORT  ztest.
    DATA : wa_header TYPE bapisdh1x,
                i_item TYPE TABLE OF bapisditm WITH HEADER LINE,
                i_itemx TYPE TABLE OF bapisditmx WITH HEADER LINE,
                i_return TYPE TABLE OF bapiret2.
               wa_header-updateflag = 'U'.
               i_item-itm_number = '000010'.
               i_item-target_qty = '4'.
               APPEND i_item.
              i_itemx-itm_number = '000010'.
              i_itemx-updateflag = 'U'.
              i_itemx-target_qty = 'X'.
              APPEND i_itemx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = '1234567890'
        order_header_inx            = wa_header
      TABLES
        return                            = i_return
        order_item_in                 = i_item
        order_item_inx               = i_itemx
    Hope this will help you.
    Regards,
    Anand.

  • Any standard process to update Sales Order in SAP via XI / Idoc ?

    Hello,
    Currently one of our end customer is creating Sales Order in Oracle system. Once the Order is created there, they send the Order information to our XI system via flat file. XI system processes the flat file and then it calls order creation function using rfc / BAPI - BAPI_SALESORDER_CREATEFROMDAT2. This works just fine.
    But now the customer wants an ability to update sales order, cancel certain line or even cancel the whole order in their Orcale system. And once that happens, they want the same thing to happen in SAP via some kind of interface automatically in the background.
    So my question is :
    what is the best way to do it ?
    Is it possible to do via idoc ? The reason I am asking it via idoc is because it sounds that's the most standard way of doing it in SAP.
    What idocs can I use ?
    Has any one implemented such interface ? And if so, can you share some info ?
    Any response is highly appreciate.
    thanks,
    Dipankar

    I woudl suggest you check ORDERS05 IDOC type (ORDCHG message type).
    FM - idoc_input_ordchg

  • Problem updating sales order partner addresses

    Hi all,
    iam trying to update addresses on sales order if there is any update on on the delivery.
    I update the VBPA-ADRNR and create the same ADRC-ADRNR.
    but when iam updating VBAP-VBELN for order using BAPI_SALESORDER_CHANGE there is a new ADRNR being created in VBPA as opposed to using the ADRNR i pass to the BAPI which is the delivery ADRNR.
    Can someone help me resove this...
    and one more small question..
    what do i pass to the paramter addr_handle in the fm ADDR_NUMBER_GET..

    i need to insert/update a record in adrc as soon as an address is updated in VBPA-VBELN of delivery.
    for this want to use ADDR_NUMBER_GET , ADDR_UPDATE/ADDR_INSERT.
    and after this process i am updating sales orders.
    but iam filling the tables u mentioned...the problem is teh new adrnr the bapi is generating instead of the one iam passing it in ADDRNUMBER(new ADRNR) in PARTNERCHANGES table and also iam passing ADDRLINK(old adrnr) field in PARTNERADDRESSES table.

  • How to update Sales Order status using  BAPI_SALESORDER_CHANGE

    Hi,
    I want to update Sales Order status using BAPI_SALESORDER_CHANGE, this BAPI is called from middle ware, but there is no parameter to pass the status value to this function, please help me how to update sales order status using BAPI only.
    Thanks
    RK

    Hi,
    Can u give me details of what status u would like to update in sales order.
    If we are able to update the status from VA02, Then BAPI will assist for the same.
    Regards.

  • Updating sales order pricing after partial delivery

    I have a requirement where due to an enhancement being implemented I need to be able to update the item pricing on the sales order after the item has been partially-delivered. Currently the standard system
    controls do not allow access to the Update Pricing button in the item conditions tab after a partial delivery for the item. Is there any way around this using the standard functionality?
    Regards
    BK GAIKWAD

    Dear,
           For update in sales pricing after delivery you require to reverse and delete delivery.
          Without delivery deletion it is not possible to update sales order's price.
          One more option is you can update your price in billing if you can not accounting of invoice.
    Regards,
    Sandip

  • How to update Sales Order Delivery Block while saving Delivery ?

    Hi,
    I have a requirement wherein i need to update sales order delivery block field(VBAK-LIFSK) while saving the delivery for the order.
    Also I need to remove this block while execution of  Backorder Rescheduling program SDV03V02 (Tcode : V_V2),
    Can anybody help me out in this?
    regards,
    Nitin

    HI,
    try using BAPI_SALESORDER_CHANGE
    pass ur vbeln in SALESDOCUMENT
    pass an 'X' to    BAPISDH1-DLV_BLOCK
    and 'X' to        BAPISDH1X-DLV_BLOCK
    Also add the UPDATE task clause, you will want to set the flag only when delivery is being saved, not before that.

  • Update sales order through workflow

    Hi,
       i developed one workflow for sales order.  after all aprovals the sales order is updating upto 2nd change. but 3rd change is not updating sales order.
    For updating sales order i am using BAPI_SALES ORDER_CHANGE function module.
    Thanks.

    Hi  Abdullah Azzouni         
    my scenario is when sales order is created or changed my workflow should trigger and make sales order as incomplete with  (Z field)  by using incompletion Procedure.
    Also some other custom fields there for other workflows in salesorder.
    In METHOD
       select single zfield1
                           zfield2
                           zfield3
                          Zfield4      <- for my workflow
                           INTO wa_ext_hdr
                          FROM vbak
                          WHERE vbeln = object-key-salesdocument.
           wa_ext_hdr-zfield ='X'.
       wa_ext_hdrx = 'XXXX'.
       MOVE 'U' TO wa_headerx-updateflag.
       MOVE: BAPE_VBAK  TO wa_extflds-structure.
       CONCATENATE object-key-salesdocument
                   wa_ext_hdr INTO
                   wa_extflds-valuepart1.
       APPEND wa_extflds TO i_extflds.
       MOVE: BAPE_VBAKX  TO wa_extflds-structure.
       CONCATENATE object-key-salesdocument
                   wa_ext_hdrx INTO
                   wa_extflds-valuepart1.
       APPEND wa_extflds TO i_extflds.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
       salesdocument     = object-key-salesdocument
       order_header_in   = wa_header
       order_header_inx  = wa_headerx
       behave_when_error = 'P'
    TABLES
       return            = i_return
         extensionin       = i_extflds.
    READ TABLE i_return INTO wa_return WITH KEY type = 'E'.
    iF sy-subrc EQ 0.
    ELSE.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ENDIF.
    Can you help on this.
    Please suggest me where i am wrong or if you know any other way to achieve this functionality guide me.
    Thanks in Advance.
    Raj

Maybe you are looking for