How to convert Webi report to pdf and save to disk.

I am having issue converting a webi report to pdf from java SDK. I know the location where the .wid file is and then I am not able to proceed further as I am not able convert to pdf and move to created file to a location.

Here is the code

IFiles iFiles = document.getFiles();
String widfile= document.getFiles().getFRSPathURL() );

The wid file is a Webi report. I want to convert this file to a pdf and save it to a location.

Could I get a code sample or an example how this is done. Any help is appreciated.


mgr_72 (BOB member since 2010-06-08)

Can I ask why you don’t just schedule the report and save it as a PDF and send it to a file location from within the scheduled task?


plessiusa :netherlands: (BOB member since 2004-03-22)

We are calling the reports on a insert of a row in a database table. I expect I can do this only from java.


mgr_72 (BOB member since 2010-06-08)

Then I suggest that what you want to do here is as part of your Java script is to use the schedule API to schedule the report to run immediately.

I’m about to use this for a slightly different approach but it will give me the ability to do what I need.


plessiusa :netherlands: (BOB member since 2004-03-22)

Thank you.

I am doing all the stuff. The report also runs successfully. When I scheduled the report the report is generated in .wid format. I need to convert this to a pdf before I send it as a email or ftp it to a different location.

Please could you help me in understanding how to get this report into a pdf.


mgr_72 (BOB member since 2010-06-08)

Well all gonig well, I should be doing this today, so I’ll let you know how I get on.


plessiusa :netherlands: (BOB member since 2004-03-22)

Well I had a quick look at this yesterday and there is a (I think) function called DocumentFormatOption. Using this you can specify Excel or PDF.

I found the information in the the SDF developer help documentation that you can download off the SAP Help website. http://help.sap.com/

Go through the code snippets for Scheduling and you will find the same thing that I found.


plessiusa :netherlands: (BOB member since 2004-03-22)

Thank you for the information. I am able to successfully schedule the report and also the report has completed with status of success in pdf format. Know I am having a new issue.

How do I know the location of this report output. I know it should be saved to the default server location. But where is this default server location specified. If there is no default location specified in the server configuration where is this report stored. Please any help will be appreciated.


mgr_72 (BOB member since 2010-06-08)

Do you want to post your code as I am curious to see how you have done it.

With regards to the default location, I’m not sure I would have though that it would go to a MyBusinessObjects directory somewhere on the server.

To change this, you can specify what that location is and in the documents I mentioned on the SAP Help website, there is information on that, however this is also where I am having difficulty as the code doesn’t seem to work.


plessiusa :netherlands: (BOB member since 2004-03-22)

Here is the code which will schedule the report successfully and will complete with the status as success.

IInfoObjects webiDocs = infoStore.query(“Select * From CI_INFOOBJECTS Where SI_ID=” + webiID);

IWebi webiDoc = (IWebi)webiDocs.get(0);

ISchedulingInfo scheduleInfo = webiDoc.getSchedulingInfo();

for (Iterator it = scheduleInfo.getDependencies().iterator(); it.hasNext(); )
{
scheduleInfo.getDependencies().remove(it.next());
}

		// Run the report once.
		scheduleInfo.setType(CeScheduleType.ONCE);

		// Run it right now.
		scheduleInfo.setRightNow(true);

		// Retrieve the IWebiFormatOptions object and specify the format.
		webiDoc.getWebiFormatOptions().setFormat(format);
		// Tell the CMS to schedule the report.
		infoStore.schedule (webiDocs);
		
		// Get a handle to the files object
		IFiles iFiles = webiDoc.getFiles();
System.out.println("Location of the Wid file" + WebiDoc.getFiles().getFRSPathURL() );

mgr_72 (BOB member since 2010-06-08)

I need to get a handle to the pdf file that was generated. I need the handle to do various operation with the file.


mgr_72 (BOB member since 2010-06-08)