Saturday, October 19, 2013

XML Publisher Step by step

  Analyse the Requirement and prepare Target Record with Required fields to Report(do all tthis using in Peoplecode)

Now XMLP Steps will start:
1) We have prepare Query with Target record (Reporting tools > PS Query > Query Manager -- Save).
2) Use this Query and Prepare Data Source (Reporting tools > BI Publisher > Data Source).
    a) Generate XML and XSD
    b) Save xml file to local System
3) Open a new Word Document and use BI-Publisher -  Add-in.
  a) Use Sample XML option to load saved xml on local system.
  b) will get Data load Successfull message.
  c) Now Prepare Template as per Client Requirement
       i) Table wizard - Table - option used to get data in Table Format
      ii) Form to Access the Fields
      iii) Free Form - Will prepare Letter/certificate Templates
  d) save Template name with ".rtf".
4) now upload this template File to Report definition in Template tab and make active status and test Visualise button.
 note: be carefull we have to use same query name
5) Then test using  xml viewer.
__________________________________
Same report to generate using people code

/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* People code to Run BI Publisher           */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
import PSXP_RPTDEFNMANAGER:*;

Local Record &rcdQryPrompts;
Local string &LanguageCd, &MyTemplate, &MyReportName, &OutFormat, &EMPLID;
Local date &AsOfDate, &BEGIN_DT, &END_DT;

Local Record &rcdSltEmp;
Local string &strEmplids;

Local Rowset &rsSltEmp;


Local Record &REC;


DoSaveNow();

&rsSltEmp = GetLevel0()(1).GetRowset(Scroll.MHN_PENDOC_TBL);
&REC = CreateRecord(Record.MHN_PENDOC_TBL);


 
 
   rem TransferPage(Page.LGE_TL_SEC);
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   /* Set XML Publisher report required parameters                            */
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   /**/
   &LanguageCd = "POR";
   &AsOfDate = %Date;
   &OutFormat = "PDF";
   REM &OutFormat = "HTML";

 
      &MyReportName = "MHN_TERM_HM";
      &MyTemplate = "MHN_TERM_HM_1";

 
 
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   /* Prompt values                                                           */
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
 
   Local PSXP_RPTDEFNMANAGER:ReportDefn &oReportDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&MyReportName);
   &oReportDefn.Get();
   &rcdQryPrompts = &oReportDefn.GetPSQueryPromptRecord();
 
   If Not &rcdQryPrompts = Null Then
      &oReportDefn.SetPSQueryPromptRecord(&rcdQryPrompts);
      &rcdQryPrompts.OPRID.Value = %OperatorId;
   End-If;

   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   /* Kick of the report process                                              */
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
 
   &oReportDefn.ProcessReport(&MyTemplate, &LanguageCd, &AsOfDate, &OutFormat);
 
   CommitWork();
 
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   /* Display Report to the user                                              */
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   &oReportDefn.DisplayOutput();
End-If;

2 comments:

  1. Thanks for your explaination :)

    ReplyDelete
  2. I have a question here. when we are submiting the template id it will run only for one template? in my xmlp i have 3 templates under one report for payment( like domestic, foreign check and overflow template) can i change this in runtime.

    ReplyDelete