cancel
Showing results for 
Search instead for 
Did you mean: 

Pay for invoice OINV / ORCT relation

former_member192187
Participant
0 Kudos
600

Hi

I will run pay for invoice in SDK, but I don't know I can Interfere in SAP tables: update OINV and add values to ORCT. I will add values in ORCT how Receipt and sign in OINV that this invoice was paid. Is it good way?

regards

KRzysztof Sala

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Krzystof,

You can create an invoice and payment with the following code:

    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("Updated")
    End If
    oCompany.GetNewObjectCode(sNum)
    oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
    oDoc.GetByKey(sNum)
    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

Also look at this posts on invoice and payment troubleshooting:

Hope it helps,

Adele

former_member192187
Participant
0 Kudos

if sNum is DocNum in ORCT?

regards

Krzysztof Sala

former_member192187
Participant
0 Kudos

Thanks very much Adele, it's run

regards

Krzysztof Sala

Answers (0)