Announcements
Hello Experts,
After searching code same as subjected topic I found it on internet but its is for 365F&O.
Could you please change it to AX 2012 R3. Codes are given below.
Thanks
code:- ////// extension of class: ReqTransPoMarkFirm /// [ExtensionOf(classStr(ReqTransPoMarkFirm))] final class ReqTransPoMarkFirmCFSClass_Extension { public container conPurchOrders; ////// updatePurchTable /// /// _purchTable protected void updatePurchTable(PurchTable _purchTable) { conPurchOrders = _purchTable.PurchId; next updatePurchTable(_purchTable); } ////// purchTablePostProcessing /// protected void purchTablePostProcessing() { next purchTablePostProcessing(); for (int i = 1; i <= conLen(conPurchOrders); i ) { PurchTable purchTable = PurchTable::find(conPeek(conPurchOrders, i), true); if(purchTable.RecId) { ttsbegin; //delete the version created for po PurchTableVersion purchTableVersion = PurchTableVersion::findLatest(purchTable.PurchId, purchTable.DataAreaId, true); if(purchTableVersion.RecId) { purchTableVersion.delete(); } purchTable.ChangeRequestRequired = NoYes::No; purchTable.DocumentState = VersioningDocumentState::Draft; purchTable.update(); ttscommit; } } } }
Hi Faiz,
If the issue is resolved, please mark the helpful answer(s) as Verified.
Hi Faiz,
In that case, you can uncomment the changes you did and comment out the method call from the method "firmSelectedPlannedOrders" (in case you don't need this functionality at all) or put some condition to execute the method. I am highlighting the method call in the screenshot.
This should resolve your issue.
Hi Gunjan,
I just commented some piece of code under method autoApproveFirmedPlannedPurchaseOrders.
It works for me...
private void autoApproveFirmedPlannedPurchaseOrders() { SetEnumerator enumerator; PurchTable purchOrder; ttsbegin; enumerator = purchIdsToAutoApprove.getEnumerator(); while (enumerator.moveNext()) { purchOrder = PurchTable::find(enumerator.current(), true); /* //Business logic commented because need PO approve throuhg workflow date 29-Oct-2020 if (purchOrder.ChangeRequestRequired && purchOrder.DocumentState == VersioningDocumentState::Draft) { purchOrder.autoApproveChangeRequest(); } */ } purchIdsToAutoApprove = new Set(Types::String); ttscommit; }
Hi Faiz,
You need to check where the purchase order status changes. There is a method in Classes\ReqTransPOMarkFirm called "submitPurchOrdersToWorkflow". I think this is where the state is changing for the POs. You can try commenting this method and check if that works.
Thanks Will,
So I have to create new class called "subReqTransPoMarkFirm" and inside method " protected void purchTablePostProcessing()".
How class "subReqTransPoMarkFirm" will call.
Hi faiz7049,
See:
class subReqTransPoMarkFirm extends ReqTransPoMarkFirm { public container conPurchOrders; protected void updatePurchTable(PurchTable _purchTable) { conPurchOrders = _purchTable.PurchId; super(); } protected void purchTablePostProcessing() { super(); for (int i = 1; i <= conLen(conPurchOrders); i ) { PurchTable purchTable = PurchTable::find(conPeek(conPurchOrders, i), true); if(purchTable.RecId) { ttsbegin; //delete the version created for po PurchTableVersion purchTableVersion = PurchTableVersion::findLatest(purchTable.PurchId, purchTable.DataAreaId, true); if(purchTableVersion.RecId) { purchTableVersion.delete(); } purchTable.ChangeRequestRequired = NoYes::No; purchTable.DocumentState = VersioningDocumentState::Draft; purchTable.update(); ttscommit; } } } }
Yes @Gunjan
Hi faiz,
What exactly is the requirement here? Are you trying to update the status of the purchase orders created from planned purchase orders?
André Arnaud de Cal...
293,323
Super User 2025 Season 1
Martin Dráb
232,191
Most Valuable Professional
nmaenpaa
101,158
Moderator