Skip to Content
author's profile photo Former Member
Former Member

add invoices and payments

Hello SAP . because when I want to create payment received related to an invoice, the delay paying around 15-25 seconds to be created , I am using di api , there is a faster way to create payments received , I have 300k of records that need to migrate to sap

, THIS MY CODE thanks !!

factura = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);

SAPbobsCOM.Payments Pagos;

Pagos = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments);

factura.CardCode = "C000" + CARDCODE;

factura.CardName = CARDNAME;

factura.DocDate = DocDate;

factura.TaxDate = DocDate;

factura.DocDueDate =DocDate;

factura.NumAtCard =NumAtCard;

factura.GroupNumber = GroupNum;

factura.SalesPersonCode = SlpCode;

factura.Comments = "Creado por SDK";

factura.FolioPrefixString = FolioPref;

factura.FolioNumber =FolioNum;

factura.Indicator =Indicator;

factura.TrackingNumber = Convert.ToString(TrackNo);

factura.ControlAccount = CUENTA_ASOCIADA;

factura.UserFields.Fields.Item("U_EXX_TIPOOPER").Value = U_EXX_TIPOOPER;

factura.UserFields.Fields.Item("U_EXC_EMBARQUE").Value = U_EXC_EMBARQUE;

factura.UserFields.Fields.Item("U_EXC_DESEMBARQUE").Value =U_EXC_DESEMBARQUE;

factura.UserFields.Fields.Item("U_EXC_NROASIENTO").Value = U_EXC_ASIENTO;

factura.UserFields.Fields.Item("U_EXC_FECHAVIAJE").Value = U_EXC_FECHAVIAJE;

factura.UserFields.Fields.Item("U_EXC_TIPOVENTA").Value = Convert.ToString(U_EXC_TIPOVENTA);

factura.UserFields.Fields.Item("U_EXC_TIPPAGO").Value = Convert.ToString(TIPOPAGO);

factura.UserFields.Fields.Item("U_EXC_SDK").Value = "Y";

factura.DocCurrency = DocCur;


factura.Lines.ItemCode = ITEMCODE;

factura.Lines.WarehouseCode = "ALM_VENT";

factura.Lines.Quantity =1;

factura.Lines.PriceAfterVAT = Math.Abs(PriceBefDi);

factura.Lines.DiscountPercent = Math.Abs(DiscPrcnt);

// factura.Lines.UnitsOfMeasurment = 1;

factura.Lines.TaxCode =TaxCode;

factura.Lines.CostingCode = agencia;

// factura.Lines.AccountCode = "_SYS00000001916";

factura.DocumentSubType = SAPbobsCOM.BoDocumentSubType.bod_Bill;


//MessageBox.Show("Factura creado exitosamente...");

string DocEntry = BL.Modules.Purchasing.BCOPayments.GetById_pasaje(NumAtCard);

string sys_origen = Convert.ToString(Convert.ToString(row.Cells["SYSORIGEN"].Value));

Pagos.CardCode = "C" + CARDCODE;

Pagos.CardName = CARDNAME;

//// Pagos.Address = "JR. TRENEMAN - 15679069";

Pagos.DocDate = DocDate;

Pagos.TaxDate = DocDate;

Pagos.DueDate = DocDate;

//// Pagos.JournalRemarks = Payments.Journalremarks;

Pagos.DocCurrency = "SOL";

Pagos.Invoices.DocEntry = Convert.ToInt32(DocEntry);

Pagos.Invoices.AppliedFC = PriceBefDi;

Pagos.CashSum = PriceBefDi;

Pagos.Remarks = Convert.ToString(TrackNo);

Pagos.CashAccount = sys_origen;

//string Metodo_pago = PayMethod.Trim();

//if (Metodo_pago == "POR PAGAR EN DESTINO") { sys_origen = BL.Modules.Purchasing.BCOPayments.GetCentroAgencia(CodDest); }

//Pagos.UserFields.Fields.Item("U_EXC_TIPOVENTA").Value = Convert.ToString(U_EXC_TIPO_TRANS);

//Pagos.UserFields.Fields.Item("U_EXX_MPFONDEF").Value = "001";

//Pagos.UserFields.Fields.Item("U_EXC_SDK").Value = "Y";

if (Pagos.Add() != 0)


oCompany.GetLastError(out lErrCode, out sErrMsg);

mensaje2 = "Factura No creada...";




mensaje2 = "Factura creado exitosamente...";


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Mar 31, 2015 at 07:13 AM

    Hi Luis,

    For that volume of information I'd think about breaking it up into "manageable" chunks (say 100 records per chunk).

    You should also have a look (if feasible) at the DTW. Maybe this will fit your scenario.

    As a last resort you can change your code to use the XML interface (basically an xml that "represents" a document) then use that for adding the document. It should be better performance wise.

    Best regards,

    Pedro Magueija

    View Pedro Magueija's profile on LinkedIn

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.