Did you tried it in some way? There is only one way: assign the correct no. through code... but Your description of what you want to do is too generic to give you more info...
You basically need to filter on the table you want to "write" to. See if a line no exisits using "find". If so then increment the line no to the next line no.
I've written a little code to automatically write a new line to the end of a purchase order if paid by credit card. Just focus on the setrange , find & "line no;" := "line no." + 10000;
IF Status = Status::Open
THEN BEGIN
"Vendor Invoice No." := "No."+'-PAID';
MODIFY;
CALCFIELDS("Amount Including Tax");
InvSetup.GET;
Purchline.RESET;
Purchline.SETRANGE(Purchline."Document Type","Document Type");
Purchline.SETRANGE(Purchline."Document No.","No.");
IF Purchline.FIND('+')
THEN BEGIN
Purchline."Line No." := Purchline."Line No."+ 10000;
Purchline.VALIDATE(Purchline."Qty. Rcd. Not Invoiced",0);
Purchline.VALIDATE(Purchline."Quantity Received",0);
Purchline.Type := Purchline.Type::"Account (G/L)";
Purchline.VALIDATE(Purchline."No.",InvSetup."Inventory Account (G/L)");
Purchline.VALIDATE(Purchline.Quantity,1);
Purchline.VALIDATE(Purchline."Direct Unit Cost",("InvLine Amount" * -1));
Purchline.INSERT;
END;
END
ELSE BEGIN
MESSAGE('Purchase Order %1 must be open!',"No.");
END;
Take it from there..Let us know if you don't understand.
You basically need to filter on the table you want to "write" to. See if a line no exisits using "find". If so then increment the line no to the next line no.
I've written a little code to automatically write a new line to the end of a purchase order if paid by credit card. Just focus on the setrange , find & "line no;" := "line no." + 10000;
IF Status = Status::Open
THEN BEGIN
"Vendor Invoice No." := "No."+'-PAID';
MODIFY;
CALCFIELDS("Amount Including Tax");
InvSetup.GET;
Purchline.RESET;
Purchline.SETRANGE(Purchline."Document Type","Document Type");
Purchline.SETRANGE(Purchline."Document No.","No.");
IF Purchline.FIND('+')
THEN BEGIN
Purchline."Line No." := Purchline."Line No."+ 10000;
Purchline.VALIDATE(Purchline."Qty. Rcd. Not Invoiced",0);
Purchline.VALIDATE(Purchline."Quantity Received",0);
Purchline.Type := Purchline.Type::"Account (G/L)";
Purchline.VALIDATE(Purchline."No.",InvSetup."Inventory Account (G/L)");
Purchline.VALIDATE(Purchline.Quantity,1);
Purchline.VALIDATE(Purchline."Direct Unit Cost",("InvLine Amount" * -1));
Purchline.INSERT;
END;
END
ELSE BEGIN
MESSAGE('Purchase Order %1 must be open!',"No.");
END;
Take it from there..Let us know if you don't understand.
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I've written a little code to automatically write a new line to the end of a purchase order if paid by credit card. Just focus on the setrange , find & "line no;" := "line no." + 10000;
Take it from there..Let us know if you don't understand.
http://www.BiloBeauty.com
http://www.autismspeaks.org