I want to create 200 Invoices, but it will takes me much time, so I prefer to create them via C/Al code.
For example every Invoice will be created with a customer and some lines
FOR i := 1 TO 200 DO BEGIN
SalesHeader.INIT;
SalesHeader."Document Type" := SalesHeader."Document type"::Invoice;
SalesHeader.INSERT(TRUE);
FOR j := 1 TO 5 DO BEGIN
SalesLine.INIT;
SalesLine."Document Type" := SalesHeader."Document Type";
SalesLine."Document No." := SalesHered."Document No.";
SalesLine."Line No." := j * 10000;
SalesLine.INSERT(TRUE);
END;
END;
There.
(Co-)author of "Implementing Microsoft Dynamics NAV 2009" http://vjeko.com/
Thanks for the code but when I put it in code unit and after variable declaration I recieve this message:
The sale Header already exists
Identification fields and values
Document type = 'Invoice', No.='200'
add salesheader."No." = ''
this should enable the trigger of the No. Series.
it does not work
if
FOR i := 1 TO 200 DO BEGIN
SalesHeader.INIT;
SalesHeader."Document Type" := SalesHeader."Document type"::Invoice;
Salesheader."Document No." = '';
SalesHeader.INSERT(TRUE);
FOR j := 1 TO 5 DO BEGIN
SalesLine.INIT;
SalesLine."Document Type" := SalesHeader."Document Type";
SalesLine."Document No." := SalesHered."Document No.";
SalesLine."Line No." := j * 10000;
SalesLine.INSERT(TRUE);
END;
END;
Does not work, then the validation of the salesheader is not standard or some setup is missing.
Either way, by only stating, it doesn't work, we can't help you any further.
|Pressing F1 is so much faster than opening your browser| |To-Increase|
Comments
Can you be more specific?
http://vjeko.com/
For example every Invoice will be created with a customer and some lines
There.
http://vjeko.com/
The sale Header already exists
Identification fields and values
Document type = 'Invoice', No.='200'
I checked too that the sales invoice no. is placed in setup.
this should enable the trigger of the No. Series.
|To-Increase|
Either way, by only stating, it doesn't work, we can't help you any further.
|To-Increase|
Thank you very much =D>