There is a way to confirm a selected lines from a purch order?
not to confirm de entire purch order
*This post is locked for comments
it does not work, Always posts all lines in the purch order, it does not matter if I select a single line.
Ok, If I have one purch order with 3 lines, I want to confirm only one line, something like packingSlip, I want to chose the lines to confirm.
I hope to have explained.
the purch order contains 3 lines, different items on each line, so I just chose one with that itemId
static void BTW_makePurchLineConfirm(Args _args)
{
PurchFormLetter purchFormLetter;
PurchFormletterParmData purchFormLetterParmData;
PurchParmUpdate purchParmUpdate;
PurchParmTable purchParmTable;
PurchParmLine purchParmLine;
PurchTable purchTable;
PurchLine purchLine;
PurchId purchId;
Num vendPurchOrderId;
int ierror;
str errorTxt;
;
setPrefix("Purchase Order");
purchId = "Purch-000001";
purchTable = PurchTable::find(purchId);
vendPurchOrderId = strFmt("%1-%2", purchId, int642str(VendPurchOrderJour::numberOfPurchOrder(purchTable) + 1));
try
{
ttsBegin;
// Set purchFormLetterParmData class
purchFormLetterParmData = PurchFormletterParmData::newData(DocumentStatus::PurchaseOrder, VersioningUpdateType::Initial);
purchFormLetterParmData.parmOnlyCreateParmUpdate(true);
purchFormLetterParmData.createData(false);
purchParmUpdate = purchFormLetterParmData.parmParmUpdate();
// Set PurchParmTable table
purchParmTable.clear();
purchParmTable.TransDate = systemDateGet();
purchParmTable.Ordering = DocumentStatus::PurchaseOrder;
purchParmTable.ParmJobStatus = ParmJobStatus::Waiting;
purchParmTable.Num = vendPurchOrderId;
purchParmTable.PurchId = purchTable.PurchId;
purchParmTable.PurchName = purchTable.PurchName;
purchParmTable.DeliveryName = purchTable.DeliveryName;
purchParmTable.DeliveryPostalAddress = purchTable.DeliveryPostalAddress;
purchParmTable.OrderAccount = purchTable.OrderAccount;
purchParmTable.CurrencyCode = purchTable.CurrencyCode;
purchParmTable.InvoiceAccount = purchTable.InvoiceAccount;
purchParmTable.ParmId = purchParmUpdate.ParmId;
purchParmTable.insert();
// Set PurchParmLine table
while select purchLine
where purchLine.PurchId == purchTable.purchId
&& purchLine.ItemId == "XXXXX"
{
purchParmLine.InitFromPurchLine(purchLine);
purchParmLine.ReceiveNow = PurchLine.PurchQty;
purchParmLine.ParmId = purchParmTable.ParmId;
purchParmLine.TableRefId = purchParmTable.TableRefId;
purchParmLine.setQty(DocumentStatus::PurchaseOrder, false, true);
purchParmLine.setLineAmount();
purchParmLine.insert();
}
purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
purchFormLetter.createFromLines(true);
purchFormLetter.transDate(systemDateGet());
purchFormLetter.proforma(false);
purchFormLetter.specQty(PurchUpdate::All);
purchFormLetter.purchTable(purchTable);
// This is the ID we hard code as the product receipt ID, if we do the posting via UI
// user would have the option to manually enter this value
purchFormLetter.parmParmTableNum(purchParmTable.ParmId);
purchFormLetter.parmId(purchParmTable.ParmId);
purchFormLetter.purchParmUpdate(purchFormLetterParmData.parmParmUpdate());
purchFormLetter.run();
ttsCommit;
info(vendPurchOrderId);
}
catch
{
ttsAbort;
}
}
it does not work, the priocess confirmed the entire purch order
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156