on 09-20-2006 9:06 PM
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
Hi Jayakumar,
Thank you very much for posting your code!
Could the issue be that for oDlv.Lines.SerialNumbers()
you have to call Add() one time less than you have Serial Numbers?
This is true for the oDlv.Lines as you know, but isn't it the same for the SerialNumbers()?
Regards,
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
I was having the same problem... With that error though I found that when I wrote the Delivery Obj to an XML file that every time that you add a Serial Number Line you are adding a blank Serial number line, and thus producing that error. I have also seen other post the same problem with the same solution of removing the Add completely for all serial numbers. Just a warning as well. If you want to create a Delivery Withless items then the assosiated SO, There seems to be a bug with SAP that will give you a error stating that some random Item (one that may or may not be in the sales order) does not have a system Serial number avaliable...
Anyways, that has been my experience,
Hope this helps
Jeremy Adam
User | Count |
---|---|
99 | |
11 | |
10 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.