This post is machine-translated. The original post in german language can be found here.

Create picking list for specific lines in a sales order

I do not know how to create a picking list by code only for certain order items.

Therefore I use the following approach:

I create the pick list using the SalesFormLetter framework and before the decisive step (executing the run() method) I delete those entries in the SalesParmLine table that I do not need.

Screenshot

static void createSalesPickingListSingleLine(Args _args)
{
    SalesTable salesTable = salesTable::find("001862"); // Sales order
    container inventTransIdCon = ["014015", "014016"];  // LOT-IDs to pick
    SalesFormLetter salesFormLetter;
    SalesParmLine salesParmLine;
    
    salesFormLetter = SalesFormLetter::construct(DocumentStatus::PickingList);

    // Do the steps manually, which normally are done in method
    // salesFormLetter.update()
    salesFormLetter.salesTable(salesTable);
    salesFormLetter.initParmSalesTable(salesFormLetter.salesTable());
    salesFormLetter.transDate(systemDateGet());
    salesFormLetter.specQty(SalesUpdate::All);
    salesFormLetter.proforma(salesFormLetter.salesParmUpdate().Proforma);
    salesFormLetter.printFormLetter(salesFormLetter.printFormLetter());
    salesFormLetter.printCODLabel(NoYes::No);
    salesFormLetter.printShippingLabel(NoYes::No);
    salesFormLetter.usePrintManagement(false);
    salesFormLetter.creditRemaining(salesFormLetter.creditRemaining());

    salesFormLetter.createParmUpdateFromParmUpdateRecord(
        SalesFormletterParmData::initSalesParmUpdateFormletter(
            salesFormLetter.documentStatus(),
            salesFormLetter.pack(),
            true,
            false,
            false));

    salesFormLetter.initParameters(
        salesFormLetter.salesParmUpdate(),
        Printout::Current);

    salesFormLetter.initLinesQuery();

    // Delete unwanted records in SalesParmLine
    while select forupdate salesParmLine
        where salesParmLine.ParmId == salesFormLetter.parmId()
    {
        if (conFind(inventTransIdCon, salesParmLine.InventTransId) == 0)
        {
            salesParmLine.delete();
        }
    }

    // Let's go
    salesFormLetter.run();
}

 

These post applies to following version:
Dynamics AX 2012

Add comment
 
 

 

 
 
 
Posts of the actual month
Juni 2020
MoTuWeThFrSaSu
1234567
891011121314
15161718192021
22232425262728
2930 
 
© 2006-2020 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.