Hi All,
I am creating a PO with 90 k lines and it is taking huge time in hours any thing we can do to reduce the time .
purchTablePartner = InvoiceBatchXML::createPurchaseOrder(poHeaderSummaryInvIB);
InvoiceBatchXML::createPurchaseOrderLines(purchTablePartner,invoiceNumberSummary,InventDim.inventDimId);
public static server PurchTable createPurchaseOrder(SummaryInvoice poHeaderSummaryInvIB)
{
PurchTable purchTablePartner;
AxPurchTable axPurchTable;
purchTablePartner.clear();
purchTablePartner.initFromVendTable(VendTable::find(InvoiceBatchXML::getVendorAccountNum(poHeaderSummaryInvIB.OVTIDSupplier)));
axPurchTable = axPurchTable::newPurchTable(purchTablePartner);
axPurchTable.parmPurchId(NumberSeq::newGetNum(PurchParameters::numRefPurchId()).num());
axPurchTable.parmPurchaseType(PurchaseType::Purch);
axPurchTable.parmRAXShipmentType(ShipmentType::None);
axPurchTable.parmDocumentStatus(DocumentStatus::PurchaseOrder);
axPurchTable.parmAccountingDate(today());
axPurchTable.parmDeliveryDate(InvoiceBatchXML::getMinimumDeliveryDate(poHeaderSummaryInvIB));
axPurchTable.parmPurchStatus(PurchStatus::Backorder);
axPurchTable.save();
return purchTablePartner;
}
public static server void createPurchaseOrderLines(PurchTable _purchTable,string20 _invoiceNumber, inventDimId _inventDimId)
{
PurchLine purchLinePartner;
AxPurchLine axPurchLine;
SON_AttachmentELMOInvoice SON_AttachmentELMOInvoiceloc;
InventTable inventTable;
while select DeliveryNote,EANCode,ItemId,DeliveryDate,ItemId,InvoicedQty,VendorInvoiceAmt from Invoiceloc
where Invoiceloc.SummaryInvoiceNumber == _invoiceNumber
{
purchLinePartner.clear();
purchLinePartner.initFromPurchTable(_purchTable);
purchLinePartner.initFromInventTable(InventTable::find(Invoiceloc.ItemId));
axPurchLine = AxPurchLine::newPurchLine(purchLinePartner);
axpurchLine.parmDeliveryDate(SON_AttachmentELMOInvoiceloc.DeliveryDate);
axPurchLine.parmPurchQty(SON_AttachmentELMOInvoiceloc.InvoicedQty);
axPurchLine.parmLineAmount(round(SON_AttachmentELMOInvoiceloc.VendorInvoiceAmt,0.01));
axPurchLine.parmInventDimId(_inventDimId);
select firstonly DefaultDimension from inventTable
index hint ItemIdx
where inventTable.ItemId == SON_AttachmentELMOInvoiceloc.ItemId;
axPurchLine.parmDefaultDimension(SON_ELMOInvoiceBatchXML::PurchLineDefaultDimension(_purchTable.DefaultDimension, inventTable.DefaultDimension));
axPurchLine.save();
}
}
any idea what thing i can do extra to make it fast???
*This post is locked for comments