Search the site

 Problem Description

When using invoice rounding you may recieve the an error that Sales Header 0 does not exists.



 Solution

Add one global variable called "Running NAS" to table 37 Sales Line. 

Add two functions to Table 37 Sales Line

  ...
   RunningNas(runNas  :  Boolen)
      "Running NAS" := runNas;
     
   IsNasRunning() isNas : Boolean
      EXIT("Running NAS");


Change function SumSalesLines2 in CodeUnit Sales Post 80

        ...
        IF NOT OldSalesLine.IsNasRunning() THEN   //---- Add this row
          InvoiceRounding(TRUE);
      END;
    UNTIL LastLineRetrieved;
END

Change function GetCustomerItemPrice Code Unit TradePoint Calculate 6041692

  ...
  RunningNAS(TRUE); //---Add this row
  VALIDATE(Type,Type::Item);
  VALIDATE("No.",itemNo);
  VALIDATE(Quantity, quantityIn);
END;
TempSalesLine.INSERT;


Change function GetOrder Code Unit TradePoint Calculate 6041692


    "Document No." := TempSalesHeader."No.";
    RunningNAS(TRUE); //---Add this row
    VALIDATE(Type,Type::Item);
    VALIDATE("No.",itemNo);
    "Description 2" := note;
    INSERT;


 


Published by: Björn Sundström / scriptserver.com