ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Codeunit 63 Sales-Explode BOM

Open deano808 opened this issue 8 years ago • 1 comments

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

deano808 avatar Oct 08 '18 14:10 deano808

That sounds reasonable! Will move the filter and count out of the if-stmt.

JesperSchulz avatar Nov 06 '18 14:11 JesperSchulz