Tuesday, June 27, 2017

X++ code to create Purchase Order Packing slip

X++ Code to Post the Purchase Order Packing Slip.

Following Job post the Packing Slip by using PurchFormLetter class.

static void CreatePOPackingSlip(Args _args)
{

    PurchFormLetter purchFormLetter;
    PurchTable          PurchTable;
    ttsbegin;
   PurchTable = PurchTable::find('PO-Demo');
   purchFormLetter = purchFormLetter::construct(DocumentStatus::PackingSlip);
   purchFormLetter.update(purchtable, // Purchase record Buffer
                           "Inv_"+purchTable.PurchId, // Invoice Number
                             systemdateget()); // Transaction date
ttscommit;
if (PurchTable::find(purchTable.PurchId).DocumentStatus ==           DocumentStatus::PackingSlip)
{
    info(strfmt("Posted Packing Slip for purchase order %1",purchTable.PurchId));
}
}

Now run the CreatePOPackingSlip job.

No comments:

Post a Comment