on 03-30-2015 4:44 PM
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;
//Detalle
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;
factura.Add();
//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...";
}
else
{
mensaje2 = "Factura creado exitosamente...";
}
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.