Skip to Content

How to update a sale order and allocating a serial number against the same sale order using DI API?

Hi Experts,

I already Created one sale order with 10 quantity and I allocated the 5 serial number against the sale order in sap screen

Now I need to add a Another 5 serial number to the same sale order using DI API method

How t o I achieve this using DI API?


Please help me to solve.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 29, 2017 at 11:54 AM

    Hi Manikandan,

    A sample:

    Documents oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
    if (oDoc.GetByKey(190))
    {
        for (int i = 0; i < oDoc.Lines.Count; i++)
        {
            oDoc.Lines.SetCurrentLine(i);
            if (oDoc.Lines.ItemCode.Equals("the item code that I want update"))
            {
                if (!string.IsNullOrEmpty(oDoc.Lines.SerialNumbers.InternalSerialNumber))
                    oDoc.Lines.SerialNumbers.Add();
    
    
                oDoc.Lines.SerialNumbers.InternalSerialNumber = "OSRN.DistNumber";
                oDoc.Lines.SerialNumbers.SystemSerialNumber = "OSRN.SysNumber";
                oDoc.Lines.SerialNumbers.Quantity = 1;
            }
        }
    
    
        if (oDoc.Update() != 0)
            MessageBox.Show(oCompany.GetLastErrorDescription());
    }
    

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded