Skip to Content

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

Batch update

Hello professionals ..

when i try to update batch number after updating a sales order document I get  the error "Invalid row "due to SetCurrentLine in sales order document doesnt happen often but when it does it causes a big problem .

here is my code ; I only update the new lines by adding the batch number because the old lines are updated by the system ..

private void Form_DataUpdateAfter(ref SAPbouiCOM.BusinessObjectInfo pVal)


            int i=0;




                oOrder = (SAPbobsCOM.Documents)Program.oDiCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);


                SAPbobsCOM.Document_Lines DocLn = (SAPbobsCOM.Document_Lines)oOrder.Lines;


                for ( i = 0; i < Matrix0.VisualRowCount - 1; i++)


                    SAPbouiCOM.ComboBox CMB = (SAPbouiCOM.ComboBox)Matrix0.GetCellSpecific("U_PHI_RP_RSV", i + 1);

                    String Reserve = CMB.Value;

                    if (Reserve == "1")//Old line


                   // add a batch number to the new lines


                    SAPbobsCOM.BatchNumbers Batch = DocLn.BatchNumbers;

                    Batch.BatchNumber = ((SAPbouiCOM.EditText)Matrix0.GetCellSpecific("U_CMC_RP_NLO", i + 1)).Value;

                    String value = ((SAPbouiCOM.EditText)Matrix0.GetCellSpecific("11", i + 1)).Value;

                    Batch.Quantity = CalculRow.ConvertDouble(((SAPbouiCOM.EditText)Matrix0.GetCellSpecific("11", i + 1)).Value);


                    DocLn.UserFields.Fields.Item("U_PHI_RP_RSV").Value = "1";


                int error = oOrder.Update();

                if (error != 0)

                    Application.SBO_Application.SetStatusBarMessage("Erreur lors de la mise a jour des lôts ");


                    Application.SBO_Application.StatusBar.SetText("Opération de mise à jour des lôts correctement achevée ",                     SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);


            catch (Exception ex)





please help .. I'm totally lost

Best regards.


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