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
0
Answers
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.