Friday, May 22, 2015

Create Multiple copies of Report in nav2009r2

Sometimes there is a need to print the multiple copies of Report in navision 2009R2. To do this there is very simple way. Now I am going to create a report to print a multiple copies of report in very simple way. I am going to create a simple ILE report to print multiple copies.
1) Create new report in given format
Untitled
2) Set first "Integer" dataitem properties "DataItemTableView" as SORTING(Number) and "NewPagePerRecord" as Yes.
3) Set second "Integer" dataitem properties "DataItemTableView" as SORTING(Number) WHERE(Number=CONST(1)).
4) Set third "ILE" dataitem properties "DataItemTableView" as SORTING(Entry No.).
5) Now write the code on CopyLoop - OnPreDataItem()
IF NoOfCopies >= 3 THEN
ERROR(Text003);
NoOfLoops := ABS(NoOfCopies) + 1;
IF NoOfLoops <= 0 THEN
NoOfLoops := 1;
CopyText := '';
SETRANGE(Number,1,NoOfLoops);

6) Now write the code on CopyLoop - OnAfterGetRecord()
IF Number >= 2 THEN BEGIN
CopyText := Text001
END;
IF Number >= 3 THEN BEGIN
CopyText := Text004;
END;
CurrReport.PAGENO := 1;
7) Leave the second "Integer" dataitem. There is no need to write any code on this dataitem.
8) Write the code on ILE dataitem as you want to filter the data or leave blank.
9)
keep your variables as i wrote
Name DataType Subtype Length
NoOfCopies Integer
NoOfLoops Integer
CopyText Text 30
Name ConstValue
Text001 Duplicate
Text002 Sales Invoice
Text003 More than two(2) copies are not permitted....
Text004 Triplicate
10) Section part is look like this
Untitled
Untitled
11) Now run the report

Untitled

Untitled

No comments:

Post a Comment