cancel
Showing results for 
Search instead for 
Did you mean: 

DI API object for Invoice & Payment

barend_morkel2
Active Contributor
0 Kudos

Hi SDK'ers,

I just want to confirm that there is no DI API business object to create A/R Invoice + Payment. I'm using SBO 2004. (is there possibly something in 2005?)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Barend,

I am not sure if this is possible in 2005. I have always just used a standard invoice and then do a payment immediately after that to close the invoice off. I know that if the IsICT field in the OINV table is set to Y it is an invoice and payment, if it is N it will appear as a standard invoice in the system.

I know this doesn't solve your problem, but maybe it can help in some way

Adele

barend_morkel2
Active Contributor
0 Kudos

Thanks!

Former Member
0 Kudos

Hi Barend,

Herewith some sample code:

        'Create the invoice:
        Dim oDoc As SAPbobsCOM.Documents
        Dim sNum As String
        Dim oPmt As SAPbobsCOM.Payments
        oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
        oDoc.CardCode = "C1000"
        oDoc.DocDate = Now
        oDoc.Lines.ItemCode = "A1000"
        oDoc.Lines.Quantity = 6
        oDoc.Lines.Price = 66
        If oDoc.Add <> 0 Then
            MessageBox.Show(oCompany.GetLastErrorDescription)
        Else
            MessageBox.Show("Added invoice")
        End If

        'Get the invoice again for reference to amounts and docnum
        oCompany.GetNewObjectCode(sNum)
        oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
        oDoc.GetByKey(sNum)

        'Create the payment object and set properties
        oPmt = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments)
        oPmt.Invoices.DocEntry = sNum
        oPmt.CardCode = oDoc.CardCode
        oPmt.DocDate = Now
        oPmt.DocTypte = SAPbobsCOM.BoRcptTypes.rCustomer
        oPmt.CashSum = oDoc.DocTotal
        If oPmt.Add() <> 0 Then
            MessageBox.Show(oCompany.GetLastErrorDescription)
        Else
            MessageBox.Show("Add Payment")
        End If

Just look at the different payment options. Bank Transfer is TransferSum, Check Payments can be multiple and is the Checks collection and same with CreditCards.

Hope it helps,

Adele

Answers (0)