Check Dimension Code blank

Hi Eveybody,

 

When add code on UnitCode use check Dimension Code on Sales Line then not work

SalesLine.RESET;
DimCode.RESET;
SalesLine.SETRANGE("Dimension Set ID",DimCode."Dimension Set ID");
DimCode.SETFILTER(DimCode."Dimension Code",'SKU');
IF DimCode.FINDSET THEN BEGIN
  REPEAT
    DimCode.TESTFIELD(DimCode."Dimension Value Code");
  UNTIL DimCode.NEXT = 0;
END;

Please help me fix code. Thanks so much.



  • You can add this code on Release of Sales document codeunit.
    Salesline.reset;
    salesline.setrange("document type","document type");
    salesline.setrange("document no.","no.");
    if salesline.findset then begin
    repeat
    salesline.testfield("shortcut dimension 2 code") //Or whatever dimension you are checking.
    until salesline.next = 0;
    end;
  • In reply to sbhatbng:

    Thanks for the reply.

    But with shortcut dimension 2 code and shortcut dimension 1 code it's Ok. I wan't search in table Dimension Set ID (table 480). Because In addition to the (shortcut dimension 1 code, shortcut dimension 2 code) I use the shortcut dimension Sku.

    Thanks so much

  • In reply to dinhson:

    glsetup.get;
    dimsetentry.reset;
    dimsetentry.setrange("dimension set id","dimension set id");
    dimsetentry.setrange("dimension code",glsetup."shortcut dimension 4 code");
    if not dimsetentry.findset then
    error('Dimension code %1 not found',glsetup."shortcut dimension 4 code");
  • In reply to sbhatbng:

    Thanks you sbhatbng.

    But it's not work, Although the SKU is not empty, it still receives an error message "Dimension code SKU not found"

  • In reply to dinhson:

    Hi

    Can you please share attached dimension set id vales please.

    Thanks
Related