4 Replies Latest reply on Feb 19, 2013 4:15 PM by RahulB

    How to retrieve XMLP Report after publishing it

      There is a custom page created which has some data (all data is display only) on level 1. There is also a link on that level 1.
      When the user comes on this page for a particular search values (from search page) and on a particular level 1 row, and clicks on that link, a XMLP report should get generated and open up.
      When the user comes to the same page with same search values and same row on level 1 later after some time/day, the XMLP report which was generated already should open up instead of generating a new XMLP report.
      Hence, the XMLP report should generated only once for a particular level 1 row and henceforth should be reused.

      Technical Logic applied so far:*
      The logic was written on the component.record.fieldchange of the link on level 1.
      I was able to generate the XMLP Data file. Using this data file, i was able to generate the report (in PDF) and publish as well.

      Created the object:
      &oRptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(<Report Definition Name>);
      &oRptDefn.SetRuntimeDataXMLFile(<XML Data file>);

      Set the outdestination:
      &oRptDefn.OutDestination = <Some Unix Path>;

      Called Process Report:
      &oRptDefn.ProcessReport(<Report Definition Template Name>, %Language, %Date, &oRptDefn.GetDefaultOutputFormat());

      And published:
      &oRptDefn.Publish("PSUNX", "", "", 0);

      The report gets published. I can view the report in pdf on
      Main Menu > Reporting Tools > XML Publisher > XML Report Search

      Issue (which is also a road block):*
      Now how should i proceed in order to open(display) the same report when the user clicks the link on level 1 again.
      How can i reopen this same report next time?
      I was wondering if i get Report Id and Process Instance (as displayed in XML Report Search), i can save both for future use. So that i can dynamically create the report URL using these 2 IDs when the user clicks the same link next time. But not able to get the correct values of these properties.
      After publish, &oRptDefn.ProcessInstance gives 0 instead of the process instance as shown in XML Report Search page.

      Please help with your expertise.
        • 1. Re: How to retrieve XMLP Report after publishing it
          Take a look at the Report class:
          import PSXP_REPORTMGR:Report;
          Local PSXP_REPORTMGR:Report &oRpt = create PSXP_REPORTMGR:Report(String(&nRptId), &prcsinstance, &contentid, &sdbname, &sRptName, &sRptDescr, &sRptURL, &sFileURL, &dRptCreateDttm, &dRptExpireDt, &sFldrName);

          There are multiple ways of achieving your goal. The easiest would be to store a reference to the report before it is published the first time in a record. This record would then contain a process instance number which can then be used in the Report class to retrieve the report. If you want to search for reports through PeopleCode take a look here:


          This is the same functionality which is used in the XML report search page.
          • 2. Re: How to retrieve XMLP Report after publishing it
            Thanks for the reply Michel..

            If i understood your reply correctly, you are saying that i should pass the process instance and pass in the process report() ???
            And find the next process instance number available to use for XMLP report generation?
            • 3. Re: How to retrieve XMLP Report after publishing it
              The process instance number gets populated automatically by PeopleSoft when calling Publish. The problem however is that you cannot retrieve the assigned process instance number through PeopleCode after calling Publish. I think this property has a use when running the report through the Process Scheduler and not the Application server (which is the case in this situation).

              Take a look at the PSRF_RINFO_TBL record. In this record all the XMLP reports will be stored with the report URL. Your requirement says that when a user enters a component with a certain search criteria and a report was already generated for that criteria the link at level 1 should open that specific report. With the PSRF_RINFO_TBL record you know which reports have been generated so far. The only thing you then need is to link a report to a specific search criteria. If you run a SQLExec on the PSRF_RINFO_TBL after you've published it you should be able to retrieve the process instance and content id. If you add either a record or some fields to the existing record for that component you can link the process instance/contentid to the search criteria. If a report already exists you can use the code I've posted in my previous post to open the report on the screen.
              • 4. Re: How to retrieve XMLP Report after publishing it
                Thanks Michel...This helps...I will try it out...