Skip to Content
0
Former Member
Sep 20, 2006 at 08:06 PM

DIAPI posting Delivery Document with Serial Numbers

342 Views

Hi,

I am using SAP 2005A, SP01, Patch 8. I am not able to create a delivery document based on Sales Order with serial number items.

Code is given below. The error i get is

Error No: -10, Message: [DLN1.WhsCode][line: 0] , 'The selected quantity of batch/serial numbers is greater than the open quantity.'

When i checked the openqty in the sales order it is 0 and i guess we cannot set it thru DIAPI. Any solutions?

Dim oSO As SAPbobsCOM.Documents

Dim oDlv As SAPbobsCOM.Documents

oSO = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)

oDlv = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes)

' iSoDocEntry contains Sales Order no

If oSO.GetByKey(iSoDocEntry) = True Then

oDlv.CardCode = oSO.CardCode

oDlv.DocDueDate = oSO.DocDueDate

oDlv.Comments = "Based on Sales Order " & iSoDocEntry & "." & oSO.Comments

oDlv.Address = oSO.Address

oDlv.ShipToCode = oSO.ShipToCode

oDlv.Address2 = oSO.Address2

oDlv.AgentCode = oSO.AgentCode

oDlv.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items

oDlv.DocumentSubType = SAPbobsCOM.BoDocumentSubType.bod_None

oDlv.Lines.BaseLine = iRowNo

oDlv.Lines.BaseType = SAPbobsCOM.BoAPARDocumentTypes.bodt_Order

oDlv.Lines.BaseEntry = iSoDocEntry

Dim objSerialNum As SAPbobsCOM.SerialNumbers

Dim sSerialNumbers(), sSysSerialNumbers(), sInternalSerial() As String

Dim iCount As Integer

objSerialNum = oDlv.Lines.SerialNumbers()

sSerialNumbers = sSupSerial.Split(",") ' Contains the List of Supplier Serial Nos value of the Selected serials

sSysSerialNumbers = sSysserial.Split(",") ' Contains the List of Sys Serial value of the selected serials

sInternalSerial = sInternal.Split(",") ' Contains the List of Internal Serial value of the selected serials

For iCount = 0 To sSysSerialNumbers.Length() - 1

objSerialNum.InternalSerialNumber = sInternalSerial.GetValue(iCount)

objSerialNum.ManufacturerSerialNumber = sSerialNumbers.GetValue(iCount)

objSerialNum.SystemSerialNumber = sSysSerialNumbers.GetValue(iCount)

objSerialNum.SetCurrentLine(iRowNo)

objSerialNum.Add()

Next

end if

iReturnValue = oDlv.Add()

Thanks,

Jayakumar