static void makPurchPackingSlipCancel(Args _args) { PurchTable purchTable = PurchTable::find("0000-000187"); VendPackingSlipJour vendPackingSlipJour; PurchFormLetter purchFormLetter; //Retrieve existing vend packingslip select firstOnly vendPackingSlipJour where vendPackingSlipJour.PackingSlipId == "MAK3101"; 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); }