Store report as .htm file
nrinish
Member Posts: 8
Hi All,
Please help me with an issue...My cust wants the sales invoice report to be saved in the computer once the report is generated for an invoice...i tried to do it but i have a problem now...i can generate and store the report as .htm file using the method SAVEASHTML()...but its taking long time and i am also getting an error while storing ....I am posting the code and the error message .... please tell me ware i went wrong..
Code:
Filename := 'C:\FileAttachment\' + "Sales Invoice Header"."No." + '.htm';
SalesInvoiceHeader.RESET;
SalesInvoiceHeader.SETFILTER(SalesInvoiceHeader."No.", "Sales Invoice Header"."No.");
IF SalesInvoiceHeader.FIND('-') THEN BEGIN
SalesInvoiceLine.RESET;
SalesInvoiceLine.SETFILTER(SalesInvoiceLine."Document No.",SalesInvoiceHeader."No.") ;
IF SalesInvoiceLine.FIND('-') THEN BEGIN
CLEAR(Rep);
Rep.SETTABLEVIEW(SalesInvoiceHeader);
Rep.SETTABLEVIEW(SalesInvoiceLine);
OK := Rep.SAVEASHTML(Filename);
END;
END;
ERROR:
There is insufficient memory to execute this function.This can be caused by recursive function calls that are used in the program. Contact your system administrator
Please help me with an issue...My cust wants the sales invoice report to be saved in the computer once the report is generated for an invoice...i tried to do it but i have a problem now...i can generate and store the report as .htm file using the method SAVEASHTML()...but its taking long time and i am also getting an error while storing ....I am posting the code and the error message .... please tell me ware i went wrong..
Code:
Filename := 'C:\FileAttachment\' + "Sales Invoice Header"."No." + '.htm';
SalesInvoiceHeader.RESET;
SalesInvoiceHeader.SETFILTER(SalesInvoiceHeader."No.", "Sales Invoice Header"."No.");
IF SalesInvoiceHeader.FIND('-') THEN BEGIN
SalesInvoiceLine.RESET;
SalesInvoiceLine.SETFILTER(SalesInvoiceLine."Document No.",SalesInvoiceHeader."No.") ;
IF SalesInvoiceLine.FIND('-') THEN BEGIN
CLEAR(Rep);
Rep.SETTABLEVIEW(SalesInvoiceHeader);
Rep.SETTABLEVIEW(SalesInvoiceLine);
OK := Rep.SAVEASHTML(Filename);
END;
END;
ERROR:
There is insufficient memory to execute this function.This can be caused by recursive function calls that are used in the program. Contact your system administrator
0
Comments
-
You do not need to filter the lines, try to use it without this. Only filter the header and set the report view to the filtered header...0
-
Hi kine,
I tried removing the line filter and kept only the Header Filter... but still its the same
... I tried writing the code in the "onpostreport " but the thing is after adding the code the "onpostreport " is running for the entire header table record...hence it takes long time and i amgetting the error...
The modified code is:
IF Counter = 0 THEN BEGIN
Filename := 'C:\FileAttachment\' + "Sales Invoice Header"."No." + '.htm';
//SalesInvoiceHeader.RESET;
SalesInvoiceHeader.SETFILTER(SalesInvoiceHeader."No.", "Sales Invoice Header"."No.");
IF SalesInvoiceHeader.FIND('-') THEN BEGIN
Counter += 1;
CLEAR(Rep);
Rep.SETTABLEVIEW(SalesInvoiceHeader);
OK := Rep.SAVEASHTML(Filename);
END; SalesInvoiceHeader.RESET;
END;0 -
Ah, you are calling this code from within the report? You are in endless loop than... 8)
You cannot call the same report from within the report, without any condition which will end this endless loop... (endless recursion)0 -
Hi kine,
I tried copying the code into a codeunit and called the codeunit from the "onpostreport " of the sales invooice report...but its still its the same ](*,) ....please help me how i can fix it [-o< ....where should i call this codeunit...
:?:0 -
The Codeunit by the user or scheduled task. It should be called from the report.
It still is a infinite loop.
You can add a function to your report called don't run the CU. The function will set a global CalledFromCU boolean to true.
you can wrap your CU with If not CalledFromCU then begin0 -
[Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

