Post Purch Receipt List programmatically

Updated: 23.04.2015

In some cases you have to post purchase order's lines partly.
You can post Receipt List only for some of Purchase lines. Here is example, it's suitable for DAX 2009.

void postReceiptList(PurchTable    _purchTable)
    PurchFormLetter_ReceiptsList    purchFormLetter;
    PurchParmLine                   purchParmLine;
    Num                             parmId;
    purchFormLetter = purchFormLetter::construct(DocumentStatus::ReceiptsList);

    purchFormLetter.initParmPurchTablePublic(_purchTable);//this method is a copy of initParmPurchTable() method, but it has public modifier

    parmId = purchFormLetter.parmId();
    purchFormLetter.parmParmTableNum   (parmId);
    purchFormLetter.transDate          (systemDateGet());
    purchFormLetter.specQty            (PurchUpdate::All);
    purchFormLetter.proforma           (NoYes::No);
    purchFormLetter.printFormLetter    (NoYes::No);
    purchFormLetter.usePrintManagement (false);
    purchFormLetter.creditRemaining    (purchFormLetter.creditRemaining());
    purchFormLetter.sumNum             (parmId);





    //tmpPurchLine is a temporary table that contains only Purch lines we need to be posted. 
    //you should prepare tmpPurchLine records before this block of code.
    while select forupdate purchParmLine
    where purchParmLine.ParmId == parmId
        select firstonly tmpPurchLine
        where tmpPurchLine.PurchId == _purchTable.PurchId
            && tmpPurchLine.LineNum == purchParmLine.LineNum;
        if (!tmpPurchLine)
            //So you should delete purchParmLine record if you don't need corresponding PurchLine to be posted
Here is the declaration of PurchFormLetter_ReceiptsList.initParmPurchTablePublic() method
Class PurchFormLetter_ReceiptsList
public void initParmPurchTablePublic(PurchTable  _purchTable)


Other blog posts

How small business shall work with major contracts. Opinion of Ruslan Kafiatullin from Neti Projects from scratch are always riskyAs a rule, implementation projects from scratch are always...
Why outsourcing company is more effective than In-house IT-specialists There are situations when in-house specialists spend most of their time awaiting requests or they cannot get their work...
Microsoft Dynamics AX program decisions are constantly improving. At first, innovations come to European companies, and only after that to Russian enterprises.We aspire to be one step ahead in this...

Subscribe for blog updates

Get updated with our blog new articles via your email!

Subscribe now