What is an A/P Invoice?
A/P Invoice is abbreviations from Account Payable Invoice. Its account or the bill must be paid to vendor based on the goods we buy. Many vendor allowing to pay after product or service already been received.
To generate document A/P Invoice in SAP B1 is using oPurchaseInvoice object.
Here is the code:Note: If your vendor use Tax amount, you can setup first on Business partner master - allowed taxDim oAPInvoice As sapbobscom.DocumentsSet oAPInvoice = oCompany.GetBusinessObject(sapbobscom.BoObjectTypes.oPurchaseInvoices)With oAPInvoice‘Header area.CardCode = your vendor code.NumAtCard = your reference no.DocDate = your posting date.TaxDate = your document date.DocType = sapbobscom.BoDocumentTypes.dDocument_Items.Comments = your remarks‘Detail area.Lines.SetCurrentLine (detail rows).Lines.itemCode = your item code.Lines.WarehouseCode = your warehouse code.Lines.Quantity = your qty.Lines.VatGroup = "ZI".Lines.UnitPrice = F_Price.Lines.LineTotal = F_AmountLngErr = .Add()If LngErr <> 0 ThenoCompany.GetLastError(LngErr, sErrMsg)Msgbox SErrMsgElseMsgBox “Create A/P Invoice Data Success”End with