Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Former Member
Not what you were looking for? View more on this topic or Ask a question