Skip to Content

Add serialnumber to an existing document

Hi

I'm trying to add serials to an existing documnet. It doesn't gives any error message, but doesn't works! Could anybody help me? Thanks!

I'm trying whit this:

SAPbobsCOM dn = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes) as SAPbobsCOM.Documents;

if(dn.GetByKey(21)) { //an existing document

SAPbobsCOM.Document_Lines lines = dn.Lines;

lines.SetCurrentLine(0);

SAPbobsCOM.SerialNumbers sn = lines.SerialNumbers;

sn.Add(); //or sn.SetCurrentLine(0);

sn.SystemSerialNumber = 1;

sn.ManufacturerSerialNumber = "55555";

sn.InternalSerialNumber = "555551";

sn.BatchID = "blabla";

int ec = dn.Update();

if(ec != 0) { ...} //handling err.message

//dn.SaveXML(... when I save the document to xml, it contains the serial, but it is not booked

}

Thanks

Zoli

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2004 at 11:58 PM

    Hi Zoli,

    I haven't tried to add serial numbers to an existing delivery yet, but have been trying to add serial numbers to a return (in order to reverse a delivery note). My problem is that although I try to use the existing SystemSerialNumber and ManufacturerSerialNumber, always a new item is created with a new SystemSerialNumber rather than using the existing item.

    It works OK if I create a delivery note and can choose from existing serial numbers, the problem seems to be that the because the items are "unavailable", they cannot be selected.

    Regards,

    Corbin

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      btw, here is code to create a new delivery note and select the serial number of the item:

      Dim oDelivery As SAPbobsCOM.Documents

      oDelivery = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes)

      Dim bolFirst As Boolean = True

      Dim bolCreate As Boolean = True

      Dim intSalesCode As Integer = 17

      With oDelivery

      .CardCode = "munce-corbin"

      .DocDueDate = Date.Now.AddDays(3)

      .Comments = "Test Delivery Note with Serial"

      .SalesPersonCode = intSalesCode

      With .Lines

      .ItemCode = "VIDGEX-9800PRO128"

      .Quantity = 1

      .ShipDate = Date.Now

      .WarehouseCode = "01"

      .PriceAfterVAT = 500

      intSalesCode = 17

      Dim SerialNumber As SAPbobsCOM.SerialNumbers

      SerialNumber = .SerialNumbers

      SerialNumber.SetCurrentLine(SerialNumber.Count - 1)

      SerialNumber.SystemSerialNumber = 58

      End With

      .Add()

      End With

      Dim strDeliveryKey As String = ""

      oCompany.GetNewObjectCode(strDeliveryKey)

      SBO_Application.MessageBox(strDeliveryKey)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.