cancel
Showing results for 
Search instead for 
Did you mean: 

Add Outgoing Payment Draft for A/P Invoice through DI API

0 Kudos
602

I need to create Outgoing Payment Draft for the A/P Invoice. i am getting the following error...help me to resolve this..." Invalid document number [VPM2.DocEntry][line: 1] "

My Code is here...

SAPbobsCOM.Payments oPayment;

oPayment = Global.oCompany.GetBusinessObject(BoObjectTypes.oPaymentsDrafts);

oPayment.DocObjectCode = BoPaymentsObjectType.bopot_OutgoingPayments;

oPayment.DocType = BoRcptTypes.rSupplier;

oPayment.CardCode = CardCode;

oPayment.BPLID = Branch;

oPayment.Invoices.DocEntry = Convert.ToInt32(ApInvoiceNo);

oPayment.Invoices.Add();

//Bank Transfer

oPayment.TransferSum = Amount;

oPayment.TransferAccount = AcctCode;

oPayment.TransferDate = DateTime.Now;

int add=oPayment.Add();

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi dinesh.s1,

Following sample code works fine in the DEMO database on FP2202:

SAPbobsCOM.Payments oIPD = (SAPbobsCOM.Payments)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPaymentsDrafts);
oIPD.DocType = SAPbobsCOM.BoRcptTypes.rSupplier;
oIPD.CardCode = "V10000";
oIPD.DocDate = DateTime.Today;
oIPD.TransferAccount = "161000";
oIPD.TransferSum = 23;
oIPD.TransferDate = DateTime.Today;
oIPD.TransferReference = "T123456";
oIPD.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_OutgoingPayments;
oIPD.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_PurchaseInvoice;
oIPD.Invoices.DocEntry = 706;
oIPD.Invoices.SumApplied = 23;
int ADPDF = oIPD.Add();

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

0 Kudos

Thanks alot...worked...

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi dinesh.s1,

Glad to know that the issue has been resolved.

Kindly help to close the thread.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

Answers (0)