dataset { dataitem(Item;Item) { DataItemTableView=SORTING("No."); RequestFilterFields = "No.","Inventory Posting Group","Location Filter","Variant Filter" ; trigger OnPreDataItem() begin Location.SETRANGE("Use As In-Transit",FALSE); DialogWindow.OPEN(Text000 +Text001 +Text002); //BETEASTD SaveFilters := TRUE; SaveFilters := FALSE; //BETEASTD end; trigger OnAfterGetRecord() var ItemVariant: Record 5401; begin IF SaveFilters THEN BEGIN LocationFilter := GETFILTER("Location Filter"); VariantFilter := GETFILTER("Variant Filter"); SaveFilters := FALSE; END; SETFILTER("Location Filter",LocationFilter); SETFILTER("Variant Filter",VariantFilter); Location.SETFILTER(Code,GETFILTER("Location Filter")); IF ReplacePreviousSKUs THEN BEGIN StockkeepingUnit.RESET; StockkeepingUnit.SETRANGE("Item No.","No."); IF GETFILTER("Variant Filter") <> '' THEN StockkeepingUnit.SETFILTER("Variant Code",GETFILTER("Variant Filter")); IF GETFILTER("Location Filter") <> '' THEN StockkeepingUnit.SETFILTER("Location Code",GETFILTER("Location Filter")); StockkeepingUnit.DELETEALL; END; DialogWindow.UPDATE(1,"No."); ItemVariant.SETRANGE("Item No.","No."); ItemVariant.SETFILTER(Code,GETFILTER("Variant Filter")); CASE TRUE OF (SKUCreationMethod = SKUCreationMethod::Location) OR ((SKUCreationMethod = SKUCreationMethod::"Location & Variant") AND (NOT ItemVariant.FIND('-'))): BEGIN IF Location.FIND('-') THEN REPEAT DialogWindow.UPDATE(2,Location.Code); SETRANGE("Location Filter",Location.Code); [b]CreateSKU(Item,Location.Code,'');[/b] UNTIL Location.NEXT = 0; END; (SKUCreationMethod = SKUCreationMethod::Variant) OR ((SKUCreationMethod = SKUCreationMethod::"Location & Variant") AND (NOT Location.FIND('-'))): BEGIN IF ItemVariant.FIND('-') THEN REPEAT DialogWindow.UPDATE(3,ItemVariant.Code); SETRANGE("Variant Filter",ItemVariant.Code); [b]CreateSKU(Item,'',ItemVariant.Code);[/b] UNTIL ItemVariant.NEXT = 0; END; (SKUCreationMethod = SKUCreationMethod::"Location & Variant"): BEGIN IF Location.FIND('-') THEN REPEAT DialogWindow.UPDATE(2,Location.Code); SETRANGE("Location Filter",Location.Code); IF ItemVariant.FIND('-') THEN REPEAT DialogWindow.UPDATE(3,ItemVariant.Code); SETRANGE("Variant Filter",ItemVariant.Code); [b] CreateSKU(Item,Location.Code,ItemVariant.Code);[/b] UNTIL ItemVariant.NEXT = 0; UNTIL Location.NEXT = 0; END; END; end; } }