Codeunit 63 Sales-Explode BOM
Hello,
I'm subscribing to the OnBeforeConfirmExplosion event and setting HideDialog. This works as expected but causes an issue when adding the component lines.
OnBeforeConfirmExplosion(Rec,Selection,HideDialog); IF NOT HideDialog THEN BEGIN FromBOMComp.SETRANGE("Parent Item No.","No."); NoOfBOMComp := FromBOMComp.COUNT; IF NoOfBOMComp = 0 THEN ERROR(Text001,"No.");
Selection := STRMENU(Text004,2);
IF Selection = 0 THEN
EXIT;
END ELSE Selection := 2;
When HideDialog = true, the NoOfBOMComp is not being set and is used later in ExplodeBOMCompLines.
Can the code be changed to:
FromBOMComp.SETRANGE("Parent Item No.","No."); NoOfBOMComp := FromBOMComp.COUNT;
OnBeforeConfirmExplosion(Rec,Selection,HideDialog); IF NOT HideDialog THEN BEGIN IF NoOfBOMComp = 0 THEN ERROR(Text001,"No.");
Selection := STRMENU(Text004,2);
IF Selection = 0 THEN
EXIT;
END ELSE Selection := 2;
Thanks Deano
That sounds reasonable! Will move the filter and count out of the if-stmt.