Send Document - What about the option of the requestpage ?

moichinoi
Member Posts: 41
Hi,
I use to print report with some customize option , for example, if a option is checked, then the report will hide a column etc...
so when I use the fonction Send, to send by Email, I cannot access the option normaly shown before printing my report.
is there way to beable to send a document, but before, set the parameter in a normal RequestPage ?
thx you
I use to print report with some customize option , for example, if a option is checked, then the report will hide a column etc...
so when I use the fonction Send, to send by Email, I cannot access the option normaly shown before printing my report.
is there way to beable to send a document, but before, set the parameter in a normal RequestPage ?
thx you
0
Best Answer
-
Hi ,
I found a solution for my problem.
So if it can be helfull for somebody else.
So to be able to choose what report have to show the requestpage when using the Send fonction instead of Print the report, I have modified the table 77, Function SaveReportAsPDF
Variable
XmlParameters :Text
Content : File
DataTypeManagement : CodeUnit 701
RecordRef : RecordRef
FieldRefDocNo and FieldRef : FieldRef
OStream : outputStream
LOCAL SaveReportAsPDF(ReportID : Integer;RecordVariant : Variant;LayoutCode : Code[20]) FilePath : Text[250]
FilePath := COPYSTR(FileMgt.ServerTempFileName('pdf'),1,250);
ReportLayoutSelection.SetTempLayoutSelected(LayoutCode);
DataTypeManagement.GetRecordRef(RecordVariant,RecordRef);
//Here make a code to select which document would you like to pop up the requespage
IF RecordRef.NUMBER = DATABASE::"Purchase Header" THEN
BEGIN
//Document Type
FieldRef := RecordRef.FIELD(1);
//DocNo
FieldRefDocNo := RecordRef.FIELD(3);
//Here make a code to select which document typewould you like to pop up the requespage
IF FORMAT(FieldRef.VALUE) = FORMAT(PurchaseHeader."Document Type"::Quote) THEN
BEGIN
Content.CREATE(FilePath);
Content.CREATEOUTSTREAM(OStream);
//Build the initial Parameters for the requestpage
XmlParameters :=
'<?xml version="1.0" standalone="yes"?><ReportParameters id="'+FORMAT(ReportID)+'">'+
'<Options><Field name="PrintInvoiceUOM">false</Field><Field name="InvoiceUnitType">0</Field></Options>'+
'<DataItems>'+
'<DataItem name="Header">'+
'VERSION(1) SORTING(Field1,Field3)WHERE(Field3=1('+FieldRefDocNo.GETFILTER+'))'+
'</DataItem>'+
'</DataItems>'+
'</ReportParameters>';
//open the requestpage with the initial parameter as builded
XmlParameters := REPORT.RUNREQUESTPAGE(ReportID,XmlParameters);
// MESSAGE(XmlParameters);
REPORT.SAVEAS(ReportID,XmlParameters,REPORTFORMAT::Pdf,OStream);
Content.CLOSE;
END
END
ELSE
REPORT.SAVEASPDF(ReportID,FilePath,RecordVariant);
ELSE
REPORT.SAVEASPDF(ReportID,FilePath,RecordVariant);
ReportLayoutSelection.SetTempLayoutSelected('');
COMMIT;
hope will help
Any comment will help too.
thx you.0
Answers
-
Hi ,
I found a solution for my problem.
So if it can be helfull for somebody else.
So to be able to choose what report have to show the requestpage when using the Send fonction instead of Print the report, I have modified the table 77, Function SaveReportAsPDF
Variable
XmlParameters :Text
Content : File
DataTypeManagement : CodeUnit 701
RecordRef : RecordRef
FieldRefDocNo and FieldRef : FieldRef
OStream : outputStream
LOCAL SaveReportAsPDF(ReportID : Integer;RecordVariant : Variant;LayoutCode : Code[20]) FilePath : Text[250]
FilePath := COPYSTR(FileMgt.ServerTempFileName('pdf'),1,250);
ReportLayoutSelection.SetTempLayoutSelected(LayoutCode);
DataTypeManagement.GetRecordRef(RecordVariant,RecordRef);
//Here make a code to select which document would you like to pop up the requespage
IF RecordRef.NUMBER = DATABASE::"Purchase Header" THEN
BEGIN
//Document Type
FieldRef := RecordRef.FIELD(1);
//DocNo
FieldRefDocNo := RecordRef.FIELD(3);
//Here make a code to select which document typewould you like to pop up the requespage
IF FORMAT(FieldRef.VALUE) = FORMAT(PurchaseHeader."Document Type"::Quote) THEN
BEGIN
Content.CREATE(FilePath);
Content.CREATEOUTSTREAM(OStream);
//Build the initial Parameters for the requestpage
XmlParameters :=
'<?xml version="1.0" standalone="yes"?><ReportParameters id="'+FORMAT(ReportID)+'">'+
'<Options><Field name="PrintInvoiceUOM">false</Field><Field name="InvoiceUnitType">0</Field></Options>'+
'<DataItems>'+
'<DataItem name="Header">'+
'VERSION(1) SORTING(Field1,Field3)WHERE(Field3=1('+FieldRefDocNo.GETFILTER+'))'+
'</DataItem>'+
'</DataItems>'+
'</ReportParameters>';
//open the requestpage with the initial parameter as builded
XmlParameters := REPORT.RUNREQUESTPAGE(ReportID,XmlParameters);
// MESSAGE(XmlParameters);
REPORT.SAVEAS(ReportID,XmlParameters,REPORTFORMAT::Pdf,OStream);
Content.CLOSE;
END
END
ELSE
REPORT.SAVEASPDF(ReportID,FilePath,RecordVariant);
ELSE
REPORT.SAVEASPDF(ReportID,FilePath,RecordVariant);
ReportLayoutSelection.SetTempLayoutSelected('');
COMMIT;
hope will help
Any comment will help too.
thx you.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions