cancel
Showing results for 
Search instead for 
Did you mean: 

Passing parameters to a report using RESTful SDK

Former Member
0 Kudos

Have anyone used RESTful SDK to generate a PDF/XLS report that takes filters/parameters?

I have seen many posts that create a report but won't take any parameters. I couldn't find any documentation either. Not sure if I need to pass the parameters in the header or in the URI.

My requirement is to call a WEBI report that might filter data based on the values passed and generate either a PDF or XLS. So far we have simple filters that filter data by customer, date etc.

Any help is greatly appreciated.

Thanks,

Sher

Accepted Solutions (1)

Accepted Solutions (1)

former_member197386
Active Contributor
0 Kudos

Hi Sher,

So, you need first to apply report filters to your document ? And they, export it to PDF, correct?

You find the official documentation is not clear enough about these points?

Best regards,

Anthony

richardc1
Explorer
0 Kudos

Anthony, I have been looking for the official documentation for how to pass parameters (prompt values) to a WEBI report. I can not find it.  Can you point me to it? 

daniel_paulsen
Active Contributor
0 Kudos

Hi Richard:

The Restful documentation is here: SAP BusinessObjects Business Intelligence platform 4.1 – SAP Help Portal Page

  • SAP BusinessObjects RESTful Web Service SDK User Guide for Web Intelligence and the BI Semantic Layer (4.1 SP7 is currently the latest)

Section 8.9 covers getting/setting refresh parameters.

Dan

Former Member
0 Kudos

Yes my request is to first apply report filters to your document  and then export it to PDF.

Thank you Richard for pointing to the section within the documentation. I am not sure if I am following the documentation though. It does say the format of the parameters for various type. With this help I am able to retrieve the parameters on a report. I got the below XML back but I am not sure how/where to insert the value. Here are the 2 examples:

  1. Report with 2 simple parameters:

<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>

<parameters>

    <parameter dpId=\"DP0\" type=\"prompt\" optional=\"false\">

  <id>0</id>

  <technicalName>Enter First Name:</technicalName>

  <name>Enter First Name:</name>

  <answer type=\"Text\" constrained=\"false\">

  <info keepLastValues=\"false\" cardinality=\"Single\"/>

  </answer>

    </parameter>

    <parameter dpId=\"DP0\" type=\"prompt\" optional=\"true\">

  <id>1</id>

  <technicalName>Enter Last Name:</technicalName>

  <name>Enter Last Name:</name>

  <answer type=\"Text\" constrained=\"false\">

  <info keepLastValues=\"false\" cardinality=\"Single\"/>

  </answer>

    </parameter>

</parameters>

     2. Report with a multi select parameter:

<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>

<parameters>

  <parameter dpId=\"DP0\" type=\"prompt\" optional=\"false\">

    <id>0</id>

  <technicalName>Enter First Name:</technicalName>

  <name>Enter First Name:</name>

  <answer type=\"Text\" constrained=\"true\">

   <info keepLastValues=\"false\" cardinality=\"Single\">

   <lov mandatorySearch=\"false\" searchable=\"true\" refreshable=\"true\" partial=\"false\" hierarchical=\"false\">

   <id>UNIVERSELOV_DS0.DO56f</id>

   <updated>2016-04-12T19:27:58.000-04:00</updated>

   <intervals>

  <interval id=\"0\">

   <value/>

   <value>Jeff</value>

  </interval>

  <interval id=\"1\">

   <value>Julie</value>

   <value>Ray</value>

  </interval>

   </intervals>

   <values>

  <value/>

  <value>Bob</value>

  <value>Mark</value>

  <value>Mike</value>

  <value>Victor</value>

   </values>

   <columns mappingId=\"0\">

  <column type=\"String\" id=\"0\">First Name </column>

   </columns>

   </lov>

   </info>

  </answer>

  </parameter>

</parameters>

This lists all the LOV's but how do I select a value? Not sure if I understand what the intervals in here is trying to tell me. Looks like this is optional when you post.

Looks like in both the parameter lists I need to inject <values><value>myfilter<value></values> before posting. Not sure if I am on the right path.

In my case I know the filter name and the value that I need to filter with. Can I construct my own XML (like below) instead of retrieving and then modifying it before posting?

<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>

<parameters>

    <parameter>

  <name>Enter First Name:</name>

  <answer>

  <values>

  <value>Bob</value>

  </values>

  </answer>

    </parameter>

    <parameter>

  <name>Enter Last Name:</name>

  <answer>

  <values>

  <value>Smith</value>

  </values>

  </answer>

    </parameter>

</parameters>

How should I post this XML? Should this be part of the request stream?

Appreciate your help.

Sher

richardc1
Explorer
0 Kudos

Thank you Daniel for providing info regarding the RESTful documentation.

Sher,  I think you misread the post above and accidentally thanked me when it was actually Daniel that provided the info.   I am just now learning the RESTful web services but I can try to answer your questions.  To schedule a report you can construct your own xml and you don't need the LOV elements and you will have to inject your own value in the <value> tags.  This link will provide a good simple example of how to schedule a webi with a prompt.

http://scn.sap/docs/DOC-56658

daniel_paulsen
Active Contributor
0 Kudos

Hi Sher,

Yes, you are on the right track.  Your XML looks fine but you may need to add the ID of each parameter.

<parameters>

   <parameter>

    <id>0</id>

     <name>Enter First Name:</name>

     <answer>

...

  <parameter>

     <id>1</id>

      <name>Enter Last Name:</name>

      <answer>

...

Keep in mind this will update the parameter values in the cached copy of the report and will not be reflected in BI Launchpad unless the changes are saved back to the CMS.

The intervals you see implies there are a lot of possible values so it is broken up into intervals of 50 values by default (if i remember correctly) so as not to give a huge list in the response.  The values shown are the first and last value in the interval (alphabetically).  I'm not sure why your first interval does not have a start value, but it appears to end with "Jeff" and the next interval starts with "Julie".

Dan

Note: Richard's link above is missing ".com"

richardc1
Explorer
0 Kudos

Oops sorry.  I type it in by hand. For some reason I can not paste in this forum.

here it is http://scn.sap.com/docs/DOC-56658

Former Member
0 Kudos

Thank you Daniel and Richard for pointing me in the right direction, I am now able to pass query filters (parameters) to a WEBI document and export a PDF using the RESTful SDK,

Daniel,

You are correct about the Id. When not passed, I got an error back stating that either "id, technicalName, description" is required when passing parameters.

My next step is to test printing/export to Excel. I guess only change will be to change the content type to "application/vnd.ms-excel".

Appreciate your help.

Thanks,

Sher

Answers (0)