Hi all
I am trying to do same functionality as if choosing Project > Item Requirement > Posting > Picking List from X++ of course without having a dialog popping up. I have several SOs that is posted in batch from a class.
I have found a couple of blogs that seems to be sharing the solution, but none of them is working for me.
Right now I have to methods that I hoped would work from looking at blog solutions, but have not had any luck yet.
private void postCreateAndPostJournal(SalesTable _salesTable)
{
SalesFormLetter_PickingList salesFormLetter;
salesFormLetter = SalesFormLetter_PickingList::newPickingList();
salesFormLetter.updatePrinterSettingsFormLetter(pickingListPrinterSettings);
salesFormLetter.createFromLines(true);
salesFormLetter.update(
_salesTable,
systemDateGet(),
SalesUpdate::All,
AccountOrder::None,
NoYes::No,
NoYes::No,
NoYes::No,
NoYes::No);
}
private void postCreateAndPostJournal_2(SalesTable _salesTable)
{
SalesFormLetter_PickingList salesFormLetter;
Query query;
QueryRun queryRun;
QueryBuildDataSource qbds;
query = new Query(QueryStr(SalesUpdate));
qbds = query.dataSourceTable(tableNum(SalesLine));
// Build query range to find those lines which needs to be posted.
qbds.addRange(fieldNum(SalesLine, SalesStatus)).value(queryValue(SalesStatus::Backorder));
qbds.addRange(fieldNum(SalesLine,SalesId)).value(_salesTable.SalesId);
qbds.addRange(fieldNum(SalesLine,SalesDeliverNow)).value('>0');
queryRun = new queryRun(query);
salesFormLetter = SalesFormLetter_PickingList::newPickingList();
salesFormLetter.chooseLinesQuery(queryRun);
salesFormLetter.specQty(SalesUpdate::DeliverNow);
salesFormLetter.update(_salesTable);
}
If anyone has had experience or comments on this, it will be greatly appreciated.
Thanks
*This post is locked for comments