最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

AX 2012: Cancel product receipt journal in X++

网络文摘 William 942浏览 0评论

Purpose:

The purpose of this document is to illustrate how we can cancel a posted product receipt in X++.

Business requirement:

Ability to cancel product receipt journal automatically. As of now Standard AX offers manual product receipt cancellation by clicking Procurement and sourcing > Inquiries > Journals > Product receipt > Cancel.

Assumptions:

Product receipt is posted.

Development:

Please find below the job to correct product receipt journal in X++:

// Developed on 28 Dec 2015 by Muhammad Anas Khan
// Blog: dynamicsaxinsight.wordpress.com
// LinkedIn: pk.linkedin.com/in/muhammadanaskhan
// Description: Ability to cancel product receipt journal
static void makPurchPackingSlipCancel(Args _args)
{
    PurchTable           purchTable = PurchTable::find("0000-000150");
    VendPackingSlipJour  vendPackingSlipJour;
    PurchFormLetter      purchFormLetter;

    //Retrieve existing vend packingslip
    select firstOnly vendPackingSlipJour
    where vendPackingSlipJour.PackingSlipId == "PS0803";

    purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip);

    //If the correct VersioningUpdateType is not set
    //the system will try to create a new packingslip
    PurchFormLetter.parmVersioningUpdateType(VersioningUpdateType::Cancel);
    PurchFormLetter.parmCallerTable(vendPackingSlipJour);

    //The rows bellow are very important. Not really sure why
    PurchFormLetter.allowEmptyTable(true);
    PurchFormLetter.initAllowEmptyTable(true);
    PurchFormLetter.multiForm(true);
    purchFormLetter.update( purchTable,     // Purchase record buffer
        vendPackingSlipJour.PackingSlipId,  // Packingslip Number
        VendPackingSlipJour.DeliveryDate,   // Transaction Date
        PurchUpdate::ReceiveNow,            // Quantity update
        AccountOrder::None,
        NoYes::No,
        NoYes::No,
        NoYes::Yes);
}

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址