
Hello there,
I am currently struggling to find the code position where entries of the "ReqPO" table are deleted when using the "Delete plan" dialogue found under "Master planning > Periodic > Plans > Delete plan."
There's the delete method in the table "ReqPlanVersion", which should be triggered by a delete action from what I see, but when I set a breakpoint and delete a plan, it's not met.
There's also the "deletePlanInternal" method in the class "ReqPlanDelete", which is called when deleting a plan. From what I saw in the debugger, stepping through the code, the call
this.backgroundJobService().startPlanVersionCleanup(sourcePlanVersion);
should be my searched position. However, I can't really seem to find the exact position where ReqPO entries are deleted.
I have a table which has to be synchronised to ProdRoute, ProdTable, ProdRouteJob, ReqPO and many more - the "delete plan" option is a task that has to be synchronised as well, so I need a position where I can enter my own code.
Thank you very much in advance!
*This post is locked for comments
I have the same question (0)The whole functionality behind deleting a plan uses a batch job. A task (PlanVersionCleanup) is being added to this batch and a few moments later the job is being executed.
The ReqPlanDelete classe's 'run'-method is being called while the job is being executed. Right before the
endLengthyOperation();
code, I added a call to a new method I created in the same class:
this.<prefix>_planDeletion();
In this method I'm comparing my table to the ReqPO table to find differences and then delete those missing jobs from my table:
private void <prefix>__planDeletion()
{
<prefix>_AsyncNum <prefix>_AsyncNum;
<prefix>_NumType <prefix>_NumType;
ReqPO reqPO;
<prefix>_Job <prefix>_Job;
RecId planVersion = <prefix>_Aux::getPlanVersion();
;
// Catch data to delete from <prefix>_Job (planned production orders)
<prefix>_NumType = <prefix>_NumType::PlannedProductionOrder;
insert_recordset <prefix>_Async(MBNumType, ProdId, ProdRefRecId)
select
MBNumType,
ProdId,
ProdRefRecId
from <prefix>_Job
group by
<prefix>_Job.MBNumType,
<prefix>_Job.ProdId,
<prefix>_Job.ProdRefRecId
where 1 == 1
&& <prefix>_Job.MBNumType == <prefix>_NumType
notexists join reqPO
where 1 == 1
&& reqPO.PlanVersion == planVersion
&& reqPO.RefId == <prefix>_Job.ProdId
&& reqPO.RefType == ReqRefType::BOMPlannedOrder;
// Delete data from <prefix>_Job
<prefix>_Job::jobDelete(<prefix>_Async);
}
I replaced my company's prefix and changed some object's names; however, the functionality should be clear and I hope this is somewhat explainable and hopefully useable for one or another.
Best regards