'Download scheduled Webi report from File Repository Server
Having launched a scheduled report in SAP BO, is it possible to somehow download from the file repository server?
I am working with the Web Intelligence RESTful API. While it is possible to export a report synchronously using the GET /documents/<documentID>?<optional_parameters>
request, I have not found any non-blocking asynchronous way except for using schedules.
Here's the intended workflow:
- Create a scheduled report ("now") using
POST /documents/<documentID>/schedules
. Use a custom unique<ReportName>
, store thescheduleID
- Poll the schedule status using
GET /documents/<documentID>/schedules/<scheduleID>
- If the schedule status is 1 (success), find the file using a CMS query
Send a
POST /cmsquery
with content{query: "select * from ci_infoObjects where si_instance=1 and si_schedule_status in (1) and si_name = '<ReportName>'"}
From the result, read"SI_FILES": {"SI_FILE1": "<generatedName>.pdf","SI_VALUE1": 205168,"SI_NUM_FILES":1,"SI_PATH": "frs://Output/<Path>"}
- Using the browser or the RESTful API, download the file
Is step 4 possible at all? What would be the URL?
The internal base path can be configured in the CMC, and the file location would be <Path>/<generatedName>.pdf
. But how can this file be accessed programmatically OR using an URL without the need to log into the BO BI interface?
Solution 1:[1]
As a workaround, it is possible to use the openReport method, thereby passing the scheduleID
(which is equal to the SI_ID
from the infostore) as parameter.
GET /BOE/OpenDocument/opendoc/openDocument.jsp?iDocID=<scheduleID>&sIDType=InfoObjectID&token=<token>
For file type PDF
, the browser internal PDF viewer is displayed. For XLS
, the download is immediately initiated.
Solution 2:[2]
Another option is to generate report directly into shared location for example to FTP server. Here is how:
In the "Folders" management area of the CMC, select an object.
Click Actions > Schedule, and access the "Destination" page.
If you are scheduling a Web Intelligence document, click Formats and Destinations.
Select FTP Server as the destination. For Web Intelligence document, select FTP Server under "Output Format Details"and then click Destination Options and Settings.
Here is the adm guide where it is explained in more details (p. 858)
https://help.sap.com/doc/24e00820a014406495980dea5d768d52/XI.3.1/en-US/xi31_sp3_bip_admin_en.pdf
Or you can check also exact steps who already done this:
https://blogs.sap.com/2015/06/10/scheduling-webi-report-output-to-ftp-shared-file-location/
After that you can expose your FTP server to internet and construct an URL for download.
Solution 3:[3]
I tried below steps to retrieve the scheduled instance of a WEBI report in any format.
Get the list of all the schedule instance with their IDs.
Method: Get Headers: X-SAP-LogonToken: <token> API: <base_url>/raylight/v1/documents/<Report ID>/schedules
Select the instance ID you received from step 1 API's response which you want to download and pass the instance ID to below API.
Method: Get Headers: X-SAP-LogonToken: <token> API: <base_url>/infostore/folder/<Instance ID>/file
Save the response to .wid/.xlsx/.pdf format using Save response -> Save to a file option on the response body of step 2 API.
I tried it and this works :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dani |
Solution 2 | Community |
Solution 3 | Nikhila Bhuse |