Error with developing a report in AL code in Dynamics 365 BC

AitorEGAitorEG Member Posts: 342
edited 2018-07-27 in NAV Three Tier
Hi eveyone,
I don't know if this is the best place to ask this question. I'm developing a new report, and the issue is this.
This is how the datset is defined:
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;

        }
    }

As you an see, I have 3 calls to the "CreateSKU" procedure, and I have this error:

h7kfbtr4fj6h.png

I've defined the procedure inside the requestPage like this:

9r3bw1pljafp.png

But it seems I should define it in other place. Any hint?

Thank you very much


Sign In or Register to comment.