Hi,
My customer is using a our POS (point of sale) system to made order and invoice (payment is done immediate). I want to import these transaction information to SAP B1. I will also use B1 to maintain my stock inventory and Journal entry. I think what I need is similar to the "A/R Invoice + Payment". Instead of creating these invoice with the B1 front-end, I would like to develop a console program in VB .NET (2008) with the B1 SDK.
I have reference the SDK help on invoice and try the following code.
'Create the Documents object
Dim vInvoice As SAPbobsCOM.Documents
vInvoice = oCompany.GetBusinessObject(BoObjectTypes.oInvoices)
'Set values to the fields
vInvoice.Series = 0
vInvoice.CardCode = "C99998"
vInvoice.HandWritten = BoYesNoEnum.tNO
vInvoice.PaymentGroupCode = "-1"
vInvoice.DocDate = Today
vInvoice.DocTotal = 5733
'Invoice Lines - Set values to the first line
vInvoice.Lines.ItemCode = "A00001"
vInvoice.Lines.ItemDescription = "IBM Infoprint 1312 喷墨打印机"
vInvoice.Lines.PriceAfterVAT = 4095
vInvoice.Lines.Quantity = 5
vInvoice.Lines.Currency = "RMB"
vInvoice.Lines.DiscountPercent = 0
'Invoice Lines - Set values to the second line
vInvoice.Lines.Add()
vInvoice.Lines.ItemCode = " A00002"
vInvoice.Lines.ItemDescription = "IBM Infoprint 1222 喷墨打印机"
vInvoice.Lines.PriceAfterVAT = 2047.5
vInvoice.Lines.Quantity = 5
vInvoice.Lines.Currency = "RMB"
vInvoice.Lines.DiscountPercent = 0
'Add the Invoice
lRetCode = vInvoice.Add
However, the vInvoice.Add always return below errors.
-2028 No matching records found (ODBC -2028)
Can you give me some advise?
Besides, I think I only need to create the invoice and payment objects so as to pretend as A/R Invoices + payment? I don't need to create an order object, isn't it?
I think it may be easier if I can load the invoice object from an XML file. Can I use the GetBusinessObjectFromXML method on invoice and payment object? Can you share with me some code samples?
Thank you very much!
Yvonne