Peoplecode to print a BI Publisher report on the click of a push button
Here, I am sharing peoplecode which is to be used for printing report using a push button from the page. All you need to do is to give the following constraints like-
&MyReportName="Name from Report Definition in PIA"
&MyTemplate="Template name from Report definition/template tab"
e.g., REPORT_NAME_1
and query prompts to filter the data in the report-
&rcdQryPrompts
e.g.,&rcdQryPrompts.PO_DT.Value = PO_HDR.PO_DT.Value;
---------------------------------------------------------------------------------------------------------------------
import PSXP_RPTDEFNMANAGER:*;
&LanguageCd = "ENG";
&AsOfDate = %Date;
&OutFormat = "PDF";
&MyReportName = "REPORT_NAME";
&MyTemplate = "REPORT_TEMPLATE_NAME";
Local PSXP_RPTDEFNMANAGER:ReportDefn &oReportDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&MyReportName);
&oReportDefn.Get();
Local Record &rcdQryPrompts, &RC1;
&rcdQryPrompts = &oReportDefn.GetPSQueryPromptRecord();
If Not &rcdQryPrompts = Null Then
&oReportDefn.SetPSQueryPromptRecord(&rcdQryPrompts);
&rcdQryPrompts.FIELD_NAME.Value = RECORD_NAME.FIELD_NAME.Value;
End-If;
&oReportDefn.ProcessReport(&MyTemplate, &LanguageCd, &AsOfDate, &OutFormat);
CommitWork();
&oReportDefn.DisplayOutput();
-----------------------------------------------------------------------------------------------------------------------
Visit and comment for new updates- Thanks
&MyReportName="Name from Report Definition in PIA"
&MyTemplate="Template name from Report definition/template tab"
e.g., REPORT_NAME_1
and query prompts to filter the data in the report-
&rcdQryPrompts
e.g.,&rcdQryPrompts.PO_DT.Value = PO_HDR.PO_DT.Value;
---------------------------------------------------------------------------------------------------------------------
import PSXP_RPTDEFNMANAGER:*;
&LanguageCd = "ENG";
&AsOfDate = %Date;
&OutFormat = "PDF";
&MyReportName = "REPORT_NAME";
&MyTemplate = "REPORT_TEMPLATE_NAME";
Local PSXP_RPTDEFNMANAGER:ReportDefn &oReportDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&MyReportName);
&oReportDefn.Get();
Local Record &rcdQryPrompts, &RC1;
&rcdQryPrompts = &oReportDefn.GetPSQueryPromptRecord();
If Not &rcdQryPrompts = Null Then
&oReportDefn.SetPSQueryPromptRecord(&rcdQryPrompts);
&rcdQryPrompts.FIELD_NAME.Value = RECORD_NAME.FIELD_NAME.Value;
End-If;
&oReportDefn.ProcessReport(&MyTemplate, &LanguageCd, &AsOfDate, &OutFormat);
CommitWork();
&oReportDefn.DisplayOutput();
-----------------------------------------------------------------------------------------------------------------------
Visit and comment for new updates- Thanks
Thanx Shashank
ReplyDeleteI got the prompt solution.
Good work keep it up.
Great Blog...
ReplyDeleteIt helped a lot!
Thanks so much for this code. It works great!
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteUmofiPrec-go Tonya Brown Click
ReplyDeleteclick
seturedro