Skip to main content

Posts

Showing posts with the label remove

how to remove reserv

// Code is added to InventJournalTable methods void removeAllJournalLinesReservation() { InventUpd_Reservation res; InventMovement inventmovement; Inventtrans inventtrans; InventJournalTrans inventJournalTrans ; if(this.Posted) return; while select inventJournalTrans index hint LineIdx where inventJournalTrans.JournalId == this.JournalId { while select inventTrans index hint TransIdIdx where inventTrans.InventTransId == inventJournalTrans.InventTransId && (inventTrans.StatusIssue == statusIssue::ReservOrdered || inventTrans.StatusIssue == statusIssue::ReservPhysical) { inventmovement = inventTrans.inventmovement(true); res = InventUpd_Reservation::newInventDim(inventmovement,inventTrans.inventDim(),abs(inventTrans.Qty),true); res.updatenow(); } } }

X++ code to remove identical copy

Our client asked for a job to remove the identical copy from VAR layer. For some unknown reason, some AOT objects are touched in VAR layer but actually are identical copy. When the developer compared the VAR layer object with the one in lower layer (BUS, SYS etc.), AX showed it was an identical copy. Here is the example on how you can remove the identical copy in X++ code: static void FindAndDeleteIdenticalObjects(Args _args) { SysTreeNode comparable1, comparable2; TreeNode curLevelTreeNode, upperLevelTreeNode; UtilIdElements utilElements, joinUtilElements; ; while select UtilElements where UtilElements.utilLevel == UtilEntryLevel::var && ( UtilElements.recordType == UtilElementType::Form || Utilelements.recordType == UtilElementType::Report || Utilelements.recordType == UtilElementType::Table || Utilelements.recordType == UtilElementType::Class || Utilelements.recordTyp...