Skip to Content
avatar image
Former Member

Adding multiple serial numbers to a Delivery note: B1 9.0

So I've successfully added a delivery with non-serialized items, and single serialized items but I'm looking for guidance on multiple serialized items per line..

In other words: ItemCode 'XYZ' is serialized and I need to create a delivery from a SalesOrder for (3)  XYZ's.

                  SAPbobsCOM.Documents odeliveries = (SAPbobsCOM.Documents)Vcmp.GetBusinessObject(BoObjectTypes.oDeliveryNotes);

                        odeliveries.Lines.BaseEntry = 123456;

                        odeliveries.Lines.BaseType = 17;

                        odeliveries.Lines.BaseLine = 0;

                        odeliveries.Lines.WarehouseCode = "WHS1";

                        odeliveries.Lines.Quantity =3;

                        odeliveries.Lines.ItemCode = "XYZ";

                        if (CommitItem.Serial_Flag == "Y")

                        {

                            odeliveries.Lines.SerialNumbers.SetCurrentLine(0);                  

                            oeliveries.Lines.SerialNumbers.SystemSerialNumber = 6;

                            odeliveries.Lines.SerialNumbers.Add();

                            //odeliveries.Lines.SerialNumbers.SetCurrentLine(1);

                            odeliveries.Lines.SerialNumbers.SystemSerialNumber = 7;

                            odeliveries.Lines.SerialNumbers.Add();

                            //odeliveries.Lines.SerialNumbers.SetCurrentLine(2);

                            odeliveries.Lines.SerialNumbers.SystemSerialNumber = 8;

                            odeliveries.Lines.SerialNumbers.Add();

                      

                        odeliveries.Lines.Add();

                    }

                    retval = odeliveries.Add();

How do I syntactically apply those serial numbers to the Delivery?

Thanks in advance Guys!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 25, 2014 at 11:40 AM

    Hi Steve,

    you are almost there :

    SAPbobsCOM.Documents oDel = SBO_Company.GetBusinessObject(BoObjectTypes.oDeliveryNotes);
    oDel.Lines.BaseEntry = 380;
    oDel.Lines.BaseType = 17;
    oDel.Lines.BaseLine = 0;
    oDel.Lines.Quantity = 3;
    //ItemCode you don't need to set - it gets the value from base document
    oDel.Lines.WarehouseCode = "01";
    if (setSerials)
    {
        oDel.Lines.SerialNumbers.SystemSerialNumber = 3;
        oDel.Lines.SerialNumbers.Add();
        oDel.Lines.SerialNumbers.SystemSerialNumber = 4;
        oDel.Lines.SerialNumbers.Add();
        oDel.Lines.SerialNumbers.SystemSerialNumber = 5;
        //no additional add for line or serialnr
    }
    if (oDel.Add() != 0)
        MessageBox.Show("Error " + SBO_Company.GetLastErrorDescription());
    else
        MessageBox.Show("Success");
    

    I didn't try your code but the only "problematic" points would be the unnecessary adding of lines in the end and setting ItemCode.

    regards,

    Maik

    Add comment
    10|10000 characters needed characters exceeded