Skip to Content
0
Former Member
Jul 27, 2005 at 06:56 AM

Trying to create a Invoice based on Order need help Error -5002

21 Views

the dreaded -5002 error is haunting me too! and I could not find a matching solution for this in the forum....

I need help quickly on this. I am trying to create invoices for some orders so the Base - Target relationship is retained. The orders I pick are all Open (DocStatus = O and the lines are all Open LineStatus = O)

here is my code

oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 0
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00001"
oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"

'-----------------------------------
'adding Line
'-----------------------------------
oInvoice.Lines.Add

oInvoice.Lines.BaseEntry = 48
oInvoice.Lines.BaseLine = 1
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.ItemCode = "A00002"
oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
           
'-----------------------------------
'adding Line
'-----------------------------------
oInvoice.Lines.Add

lRetCode = oInvoice.Add

If lRetCode <> 0 Then
    gObjCompany.GetLastError lErrCode, sErrMsg
    MsgBox (lErrCode & " " & sErrMsg)
End If