Hello Community, i'am trying to sent a purchase order update into the batch system like the batch button on the purchform does. But it doesn't work right now. The query in PurchFormLetter.run does not get any records and does not at the task to the batch system. I think it's because the parm - tables are not written to the database. Does anybody have an idea what's wrong here? See my code at the bottom.
Regards Andi
static void TST_PostPurchBatch(Args _args) { PurchFormLetter letter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder); PurchTable purchTable = PurchTable::find('000376'); PurchParmLine parmLine; ; ttsBegin; letter.purchTable(purchTable); letter.transDate(systemDateGet()); letter.specQty(PurchUpdate::All); letter.proforma(false); letter.printFormLetter(true); letter.createParmUpdate(); letter.initParameters(letter.purchParmUpdate(), PrintOut::Current); // Printout info(letter.parmId()); letter.initLinesQuery(); letter.chooseLinesQuery(); while select forUpdate parmLine where parmLine.ParmId == letter.parmId() { // changed the Qty parmLine.ReceiveNow = 3; // the following is stollen from the SalesEditLines form (field modified method) parmLine.setQty(parmLine.purchParmTable().ordering, letter.purchParmUpdate().creditRemaining); parmLine.setInventReceiveNow(); parmLine.setLineAmount(); if (parmLine.closed) { parmLine.remainAfter = 0; parmLine.setRemainAfterInvent(); } // parmLine.calcPackingUnitQty(); parmLine.update(); } //letter.run(); Don't want to start directly letter.batchInfo().parmBatchExecute(true); letter.batchInfo().parmGroupId(''); letter.batchInfo().doBatch(); ttscommit; BatchRun::runJobStatic(letter.batchInfo().parmBatchId()); }
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (