Problem while inserting lines in a quote

poppinspoppins Member Posts: 647
edited 2013-09-06 in NAV Three Tier
Hi everyone,
I am trying to run a report where I have to insert lines in a quote.
Here is the insertion code:
  RecSalesLines.RESET;
  RecSalesLines.SETRANGE("Document Type",RecSalesHeader."Document Type");
  RecSalesLines.SETRANGE("Document No.",RecSalesHeader."No.");
  IF RecSalesLines.FIND('+') THEN
    LineNo:= RecSalesLines."Line No.";
    
  IF Famille<>Item."Family Code" THEN
    BEGIN
      RecSalesLines."Document Type" := RecSalesHeader."Document Type";
      RecSalesLines."Document No."  := RecSalesHeader."No.";
      RecSalesLines."Line No."  := LineNo+50;
      RecSalesLines.VALIDATE(Type,0);
      RecSalesLines."No."           :='';
      RecSalesLines.Description     := "Code Grande Famille";
      RecSalesLines.INSERT;
      Family:=Item."Family Code";
    END;
    RecSalesLines.INIT;
    RecSalesLines."Document Type" := RecSalesHeader."Document Type";
    RecSalesLines."Document No."  := RecSalesHeader."No.";
    LineNo                        := LineNo + 10000;
    RecSalesLines."Line No."      := LineNo;
    RecSalesLines.Type            := RecSalesLines.Type :: Item;
    RecSalesLines.VALIDATE("No.","No.");
    RecSalesLines.VALIDATE(Quantity,1);
    RecSalesLines.INSERT(TRUE);
The field No. of table Sales Line contains a value (DISQUE-AB) that cannot be found in the related table (Item).
I checked the Item table, and I found an Item with a No. DISQUE-AB.
I tried to debug, the blocking instruction is:
RecSalesLines.VALIDATE("No.","No.");
What shall I do?

Answers

  • poppinspoppins Member Posts: 647
    I solved the problem....
    Infact, the problem was not in the code but in the item itself....
Sign In or Register to comment.