This post describes the typical code required to run a Webi document and export the result to PDF, Excel, CSV or XML file. Here is the compete code .
The workflow is the following
- Open a webi document
- Run queries
- Set prompts and contexts
- Export
- Close
The important is that the queries should be run before setting the prompts.
Open a Webi document
Let’s assume that we found an Id of Webi document.
DocumentInstance doc = reportEngine.openDocument(infoObject.getID());
Run queries
The queries can be run using DocumentInstance.refresh() or DataProviders.runQueries().
doc.refresh();
Prepare answers to prompts
It is convenient to create a map that for each prompt provides a set of values, and later use this map to enter the prompts.
HashMap<String, String[]> answers = new HashMap<String, String[]>(); answers.put("Country:", new String[]{"US", "France"}); answers.put("Year:", new String[]{"FY2004"});
(Here we assume that the document has two prompts “Country:” and “Year:”.)
Enter the prompts values
For each prompt, the code looks up the values in the map, enters the values using Prompt.enterValues().
After that, it sets the prompts using DocumentInstance.setPrompts(). At this point, if all mandatory prompts are set, the document is be refreshed.
Note that you can get name of the report in two ways. Prompt.getID() return original name and Prompt.getName() returns localized name (if there are translations for the document).
Prompts prompts = doc.getPrompts(); for (int i = 0; i < prompts.getCount(); i++) { Prompt prompt = prompts.getItem(i); String[] answer = answers.get(prompt.getID()); if (answer != null) { prompt.enterValues(answer); } } doc.setPrompts();
Check if the document has been refreshed
If there are mandatory prompts that are not answered, setPrompts() will not refresh document. If so we print error message.
if (doc.getMustFillPrompts()) { System.out.println("ERROR: Mandatory prompts has not been entered"); }
Also it is possible that there are multiple contexts and one need to be selected in order to run the document. In most cases the documents are designed to avoid prompting about contexts, so here we assume that there is no need to select one. But just in case, we check this also.
if (doc.getMustFillContexts()) { System.out.println("ERROR: Context has not been selected"); }
Export to PDF
We can export complete document, a report of the document, or data providers.
For instance to export the document to PDF, we can get view in the PDF format and write the contents to a file.
BinaryView binaryView2 = (BinaryView)doc.getView(OutputFormatType.PDF);
String title = infoObject.getTitle();
writeBytes(binaryView2.getContent(), title + ".pdf");
Here we use an auxiliary function that writes byte array to a file.
public static void writeBytes(byte[] data, String filename) throws IOException { File file = new File(filename); FileOutputStream fstream = new FileOutputStream(file); fstream.write(data); fstream.close(); }
Export to Excel
We can export the document to an Excel file using similar code:
BinaryView xlsView = (BinaryView)doc.getView(OutputFormatType.XLS);
writeBytes(xlsView.getContent(), title + ".xls");
There are two types of Excel output format type, OutputFormatType.XLS is optimized for presentation and OutputFormatType.XLSDataCentric is optimized for data manipulation.
Export to CSV
We can export data from one or all data providers to a CSV file:
CSVView csvView = (CSVView)doc.getDataProviders().getView(OutputFormatType.CSV);
writeBytes(csvView.getContent().getBytes(), title + ".csv");
BinaryView.getContent() returns content as byte array, while CSVView.getContent() returns String. Therefore we use String.getBytes() to adhere the function writeBytes().
Export to HTML
It is also possible to export each report of the document individually for instance to a HTML files. In this case you need to change pagination mode to listing otherwise you can get partial result.
Reports reports = doc.getReports(); for (int i = 0; i < reports.getCount(); i++) { Report report = reports.getItem(i); report.setPaginationMode(PaginationMode.Listing); HTMLView htmlView = (HTMLView) report.getView(OutputFormatType.DHTML); writeBytes(htmlView.getContent().getBytes(), title + " " + i + ".html"); }
Done
That is it.
doc.closeDocument();
Hi,
This code is very good. It reduced a lot of efforts. Could you please provide the same for BO 3.1
Regards,
Praveen
LikeLike
It is for BO 3.1 (but should also work for 4.0). Any problem with running it?
LikeLike
very nice post,please let me know where to write this code
thanks
LikeLike
Hi Sindhu,
We need to write this in Eclipse or any IDE after adding jars of BO4.0.
Please check how to do this in SDK category of this webpage. Dmytro explained it very clearly .
Regards,
Raghu
LikeLike
Hi Dmytro,
I am trying to export report instances in WEBI format to PDF format.
I use the same code as yours
BinaryView binaryView2 = (BinaryView)doc.getView(OutputFormatType.PDF);
String title = infoObject.getTitle();
writeBytes(binaryView2.getContent(), title + “.pdf”);
If the number of pages in the report instance are around 2000 pages , This code works.
But we have reports with close to 9900 pages.I do not see any error message or break, But no output is seen.
Is there anyway to fix this issue?
Thanks in Advance for your suggestion.
Vadi
LikeLike
Hi Vadi
I assume you hit the limit for Maximum Character Stream Size for Web Intelligence Processing Server which is 5MB by default. Try to increase it.
It is strange that you do not get any error message. It cannot probably fail silently. Check that your catch block is not empty but prints exception message.
Typical error message is “Maximum character output size limit reached (Error: ERR_WIS_30272)”
(Do you print those huge documents?:))
LikeLike
I am using the latest release of BI 4.1 SDK and need to download webi report instance to disk so that I can programatically restore these webi document instances to another BI server. Is there a way to download documents in a raw byte[] stream to then save to disk or push to another BI server?
LikeLike
Hi,
Thanks for the quick response. It’s working for 4.0. I will try it on 3.1 today. I am trying to add a line to get the execution time of each report in the output. If Possible could you please help me to add the execution time of each report.
Thanks & Regards,
Praveen
LikeLike
Hi Praveen
Before doc.setPrompts(), add
After doc.setPrompts(), add
LikeLike
Hi, This is really Helpful.
Is there any way to Refresh the document every 5 minutes?
LikeLike
Hi,
Many Thanks.
Regards,
Praveen
LikeLike
Your codes have been very helpful and I appreciate you sharing them.
I don’t mean to be picky, but just wanted to let you know that one of the sections you say Export to XML instead of Excel.
Thanks a lot. Your code is really helping me to hit the ground running!
LikeLike
Corrected. Thank you 🙂
LikeLike
Hi.
I don’t undestand where is the path to save exported files.
Can you help me?
I’m newbie of Java.
Thanks
Stecas
LikeLike
In the example, the exported files are saved to the current folder.
You can specify folder when writing file e.g.
LikeLike
Wonderful.
Thanks for the reply.
I’ll try this afternoon
LikeLike
Hi ,
How to implement this code onto BO server? I want users when they export webi reports to excel- a default string to be saved along with it inside the excel.
LikeLike
Hello
thanks for this useful example. Could you publish the list of jars you use to run this program ?
Here we can execute it, we have an error on the refresh call.
Regards
PS: Thanks for your site
LikeLike
XI 3.x: There is a list of JARs at the end of
https://bukhantsov.org/2011/08/getting-started-with-businessobjects-java-sdk/
XI 4.x: Include all JARs from
[SAP BusinessObjects]\SAP BusinessObjects Enterprise XI 4.0\java\lib\*
(without subfolders)
What error did you get?
LikeLike
Hello
it’s in R4 and you’re right with the 347 jars in the folder LIB, it works.
Thanks for your quick return.
François
LikeLike
Hello,
Thank you very much for your excellent code. I am using 4.0 trying to save a file to XLSX format. 4.0 says it now supports this format but when I use OutputFormatType.XLSX I get an error.
Do you know how this can be achieved.
Thanks much,
Jen
LikeLike
It works for me.
What is the error message?
LikeLike
Hi dymtro,
I try to retrieve the scheduling information for each of the reports in a folder.
Could you please help me on how i can check whether the report has been scheduled or not and then execute the below one. Otherwise its throws null as the report is not scheduled itself.
Also it would be great if we have any sample code to retrieve all the schedule related information.
iRepObject=(IInfoObject) iRepObjects.get(iRepObjs);
System.out.println(“Report Schedule information IProperties prop = iRepObject.properties();
System.out.println(“Last Run Time ……..”+prop.getProperty(“SI_LAST_RUN_TIME”).getValue().toString());
Thanks in advance for your help.
LikeLike
I am not sure if this the easiest way…
You can get result of two queries:
A: all reports
B: recurring instances
A report from A can have multiple recurring instances in B. There is parent-child relation between them: A.SI_CUID=B.SI_PARENT_CUID. So to determine if a report is scheduled, you need to check if there is a child in recurring reports.
The scheduling information can be retrieved from the second query.
LikeLike
BinaryView xlsView = (BinaryView)doc.getView(OutputFormatType.XLS);
writeBytes(xlsView.getContent(), title + “.xls”);
I want when conversion happens , It ask for the OPEN OR SAVE EXCEL ? HOW CAN I ACHIEVE THAT ?
THANKS.
LikeLike
I assume you are developing JSP application. You can take a look how it is implemented in BO:
…\webapps\AnalyticalReporting\viewers\cdz_adv\downloadPDForXLS.jsp
e.g.
LikeLike
Hi
You are right.I am developing the Jsp application , but to generate the .xls and .pdf Ihave used the java class file ,so my question is how to I get the response object into the java class ? can you give me some idea to open or save excel or PDF into the java class
LikeLike
Hello, i am currently working on the preliminary studies for a tool based on BO Java SDK to document the content of Universe & Reports (Dataproviders, Queries Reports, ..) and eventually export universe and reports structures in XML format. Is there a tool in your libraries that is doing that ?
Thanks. Serge
LikeLike
Hi Serge,
There is tool for documenting Universes https://bukhantsov.org/2011/09/universe-documenter/ but it exports into Excel. I think it is easier to write own tool rather than to reuse parts of universe documenter because the Designer SDK is quite straightforward.
I do not have a tool for documenting reports structure. You can search on BOB’s downloads http://www.forumtopics.org/busobj/viewforum.php?f=25.
Just curious, why do you need the universes and reports structures in XML?
LikeLike
hi. thanks for the answer. if I understand the Universe Documenter is based on the .Net SDK , not the Java one, and for the report part we will probably need to dig into details that are only available thru the Java Sdk.
XML is because our requirement is to feed the structures back into IBM Cognos (Framework Manager, Report Studio, etc.) after proper transformation and those tools take XML as input. in fact they work natively in XML.
LikeLike
Universe Documenter is using Designer COM SDK. There is no BO Java SDK for universes. You can try to use a Java COM bridge (e.g. JACOB) if you want to use Java instead of Microsoft products.
There is both Java and NET Report Engine SDK, however NET version is very limited, it is probably not suitable for your needs.
LikeLike
Hi dmytro,
I was able to run the program and send the resulting pdf to a Document Repository web-service for long term storage. It all worked fine and I thank you for sharing your code.
My only question is that it looks like the code is running interactively. Is there a way to schedule instances and from the result of an instance to get the PDF file? I’m afraid that running all reports interactively will take too long so I was thinking something like, schedule the report in advance and use the SDK to get the resulting PDF to send it. (I guess I would need to check the scheduled parameters to make sure I’m getting the right report).
Sorry for the long question.
LikeLike
Hi Dmytro,
It’s a good idea JC
If we can read report name and prompts from excel file to run the reports and save PDF.
The excel file can have report name, prompt1,2,3,…. in its columns which will be read by our SDK code.(user name,password,authenticationmode,server can also be placed some where in excel file)
It would be great to have such a jar or.exe and excel file combination.
Regards,
Raghu
LikeLike
Hi
Thanks for your replied previously .
I am successfully generating report into PDF as well as into Excel ,but there is some report which is large soI am getting the message like
Maximum binary output size limit reached (ERR_WIS_30271)
I foind into the google but there is says to go into the server and updated the file size for report,
but I want is there any way from the clinet side to resolve this things ??
Thanks ..
LikeLike
The only good way to resolve on client side is to reduce the size of the output file (stream) e.g. by adding filters or exporting part of the document.
LikeLike
There is option for binary stream size in the WebIltelligenceProcessingServer(CMC).
Increase “Binary Stream Maximum Size” and try again.
LikeLike
Hi,
I was hoping you could help me with a problem were having with reportEngine.openDocument. We have some strange behavior, it can take up to 25 minutes before opendocumetn is done. Other times it´s done in 45 seconds using the same report and server.
Any idea where we can start looking ?
Thank you.
23/04/13 10:20:47:181 CEST] PERF>>> reportEngine.openDocument() took 25’34.900ms
[23/04/13 10:20:47:778 CEST] PERF>>> documentInstance.refresh() took 00’00.597ms
[23/04/13 10:20:47:841 CEST] PERF>>> documentInstance.getPrompts() took 00’00.063ms
[23/04/13 10:20:47:841 CEST] PERF>>> populateWebiPrompts() 1 took 00’00.000ms
[23/04/13 10:20:47:999 CEST] PERF>>> document.save() took 00’00.158ms
[23/04/13 10:20:48:219 CEST] PERF>>> documentInstance.setPrompts() took 00’00.220ms
[23/04/13 10:20:48:219 CEST] PERF>>> populateWebiPrompts() 2 took 00’00.000ms
[23/04/13 10:20:48:313 CEST] PERF>>> cleanup took 00’00.094ms
[23/04/13 10:20:48:313 CEST] PERF>>> ReportPrompts.setReportPrompts() took 25’36.032ms
[23/04/13 10:20:48:407 CEST] report scheduled!
LikeLike
The report is run when all prompts are set so it is expected that set prompts takes the most of the execution time.
How much does it take to refresh the report in Webi? Does the program set all prompts correctly? You can try to retrieve and print the prompt values after you set them.
LikeLike
Hi dmytro
Can you please update on how to create user prompts?
In the eg. above u mentioned how to set values to prompts.
Thanks
LikeLike
This is primarily related to how to create documents. You can start from there and use the documentation to find solution. I believe it is something like:
LikeLike
I understand that we will be able to generate the reports in PDF, Excel, HTML formats. Could you please help me to generate the report in Microsoft word document.
I got to know from surfing that we will not be able to generate word directly. Is it possible to call acrobat XI from webi to convert pdf to word or something. Have you ever come across this scenario? Please help asap.
LikeLike
Perhaps, you can generate report in XLS format and then convert to DOC using Apache POI. I have not done this before.
LikeLike
Hi Dmytro,
Can yu please let me know if we can save the report (.wid format) with data as well with out refresh on open option besides PDF, XLS….
Regards,
Raghu
LikeLike
You can download Wid file but you need to have the corresponding infoobject.
https://bukhantsov.org/2012/07/how-to-retrieve-wid-file-for-a-web-intelligence-document/
So if you want change some report options, you probably need to (1) create a copy of the report, (2) refresh it, (3) change options, (4) save WID, and (5) remove the copy at the end.
LikeLike
Can we put breaks also through sdk in a webi document?
LikeLike
If query has Service, Service Line and Revenue:
LikeLike
dmytro
Thanks a lot!!!!!!!!
Can u please tell how to put input controls also?
Also want to know how to merge domensions?
LikeLike
Reg.megring dimensions. I have not tried this but i assume something like:
See also SynchroManager
Reg. input controls. I do not think there is a public interface for this. Probably com.businessobjects.adv_ivcdzview.InputFormFilters and related classes can do the job. But you will have to spend some time to figure out how to use that since it is not documented anywhere.
LikeLike
Hi Dmytro
I am trying to Merge the object Year from 2 dataproviders but getting the error NullPointerException in method createLink(Unknown Source)
The code is
SynchroManager sm=documentInstance.getDictionary().getSynchroManager();
sm.createLink(“Year_M”, “mergedYear”,reportDictionary.getChildByName(“Year(Query 1))”),reportDictionary.getChildByName(“Year(Query 2))”));
LikeLike
Probably you are using wrong name. Is this not null: reportDictionary.getChildByName(“Year(Query 1))”)?
You can print names of the objects from reportDictionary to see the right names.
LikeLike
Hi
The reportDictionary has 2 objects with name Year.
I tried that also but got below exception:
Exception in thread “main” com.businessobjects.rebean.wi.ServerException: An internal error occured while calling ‘processDPCommands’ API. (Error: ERR_WIS_30270)
at com.businessobjects.wp.om.OMHandler.documentLoadingError(Unknown Source)
at com.businessobjects.wp.xml.XMLLoader.processDPCommands(Unknown Source)
at com.businessobjects.wp.xml.XMLLoader.processDPCommands(Unknown Source)
at com.businessobjects.wp.om.synchro.OMSynchroManager.processCommand(Unknown Source)
at com.businessobjects.wp.om.synchro.OMSynchroManager.createLink(Unknown Source)
at org.kiran.javatool.MergeMultipleDataProviders.main
LikeLike
How to add 2 universes to a report?
LikeLike
You can add second universe with:
LikeLike
how to get Datasourceid?
LikeLike
There is a link to documentation. You could see that “dataSourceID – the ID of the universe the new data provider should be based on.” Is your question how to get id of the universe?
LikeLike
yes.
LikeLike
See “Create new document” on https://bukhantsov.org/2013/04/how-to-create-a-webi-document-using-java-report-engine-sdk/ how to query CMS and find infoobject corresponding to the universe. Then
LikeLike
Hi Dmytro
infoObject.getID() returns int value?
DataProvider dataProvider = dps.createDP(infoObject.getID(), 0);
M getting err!!
Also can u provide any link which has this documentation?
LikeLike
try
LikeLike
Hi Dmytro
I tried the above code but getting below error
“Cannot run an empty query”
Though i have fetched few objects from the Universe..
LikeLike
This worked for me. Are you sure that you are adding to the right data provider/query? Check the logic.
LikeLike
Ya
It worked for me also 🙂
Thanks a lot!!!!!!!!!!
LikeLike
http://help.sap.com/javadocs/boe/xi31/ – java documentation
LikeLike
Just curious, what are you developing?
LikeLike
Hi Dmytro
I am trying to create a utility that will do most of the report development tasks by itself…
LikeLike
Hi Dmytro
Is it possible to access the folders of MyFavorites folders thorugh java(which admistrator has created)?
I can view them thorugh webi, since i have admin access.
LikeLike
Surely it is possible. You should find infoobject corresponding to MyFavorites of Administrator and then find all children.
LikeLike
Hello All,
Our app presently creates the reports in desired formats (pdf, excel etc.). But some of the reports take long and the user has to wait for the report to be converted into PDF. So we are scheduling them and allowing the user to come back and view it later. But this functionality we could achieve only with webi.
Is there a way to ask BOE SDK to format the report in pdf format and keep with it and later at users demand retrieve it in pdf format?
Please note that our java application does not want to convert to pdf format and physically save it in some location for later retrieval.
Also, I haev noted that with BO tool one can save the report in formats like pdf, excel or csv etc. I want to integrate this feature via Java code. Can this be done using BOE SDK? I want BO to save my report in PDF format, so that it can be viewed on demand.
Thanks
Jacuz
LikeLike
>> Is there a way to ask BOE SDK to format the report in pdf format and keep with it and later at users demand retrieve it in pdf format?
You can schedule the document with SDK. Almost all that can be done in Webi/Infoview can be done with SDK.
LikeLike
Hi dmytro
How to add associated dimension to a detail varaible?
LikeLike
http://help.sap.com/javadocs/boe/xi31/re/en/com/businessobjects/rebean/wi/VariableExpression.html#setAssociatedDimension(com.businessobjects.rebean.wi.ReportExpression)
LikeLike
can you apply column filters as part of an Excel file exported from Business Objects?
LikeLike
It is not straightforward. You need either to modify the report layout before export or to remove columns from the exported excel spreadsheet.
LikeLike
I compile and run this but whenever I set query to get SI_ID=reportid it finds the report but then immediately says finished! what gives?
LikeLike
Have you removed the condition
?
LikeLike
Hi
Can you pls help me in resolving my issue. I have a webi 4.0 report in which last 2 columns have few nulls.when I export them to xls file last 2nd column values are not displayed at all. awaiting for reply.
Thanks much in advance
LikeLike
Are the values exported if you save the document as Excel from Webi interface?
LikeLike
yes last column values are displayed in the excel but not the 2nd last column.
LikeLike
Hi
We are trying to publish the report block data as webservices and we wanted to consume it to push the data to Java front end for further process.
Could you please help us on how we can consume the published webservices data? I believe that it will be Qwaas..Please advise.
Thanks,
Priya
LikeLike
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70094744-4144-2f10-64a1-f2e4f74e282a?QuickLink=index&overridelayout=true&53824530166488
or search
Consuming Query as a Web Services in .NET and Java Applications
LikeLike
Thanks Dmytro. Could you also help to understand whether we would be able to retrieve the report level data directly (just like recordset where we take datasource level data) other than pulling in other formats like PDF, Excel, XML, HTML. XML data that we get is having the CSS and formatting details also to misguide us. Currently we are not sure how to take the report level data to get the formula, aggregation applied on it.
Please let me know if I havent made it clear. Kindly help.
Thanks,
Priya
LikeLike
Hi dmytro
I am trying to add a dimension object, by default its adding all its detail objects as well.When i am trying to display the dimension object in my report, its showing all detail objects as well, which i dont want.
Is there any way to restrict the data till dimension object?
LikeLike
You are probably adding by name. Try adding by object id.
This is similar to class. If you select a class, all objects from the class will be added.
LikeLike
Hi Dmytro,
I am trying to use the code provided by you here to export a prompted WEBI report in PDF,XLS format. I have tried for both the single value as well as LOV prompt answers , but for both the cases i am encountering two strange issues:
1- If i invoke doc.refresh(),after that if i try to use doc.getPrompts(), it gives me indexOutOfBoundException. I believe doc.refresh() refreshes the instance and not the report altogether,so i skipped it.
2- After entering the prompt values, i called doc.setPrompts() but i get the same
indexOutOfBoundException again.
Here is the stackTrace:
Exception in thread “main” java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.sap.sl.sdk.workspace.service.WorkspaceServiceImpl.getParametersList(WorkspaceServiceImpl.java:391)
at com.businessobjects.rebean.wi.internal.WIDocumentInstance.getParameters(WIDocumentInstance.java:1088)
at com.businessobjects.rebean.wi.internal.WIDocumentInstance.getPrompts(WIDocumentInstance.java:316)
at com.businessobjects.rebean.wi.internal.WIDocumentInstance.setPrompts(WIDocumentInstance.java:616)
at BOE.BOEDocumentExport.main(BOEDocumentExport.java:87)
Please guide me on the same.
Thanks,
Saurabh
LikeLike
It is not working for a specific report or for any report?
What is the version and SP of BO?
LikeLike
Hi,
In my application I i get the report any try to convert it to csv using poi. This works fine with BO-3.1 jars.
But once i use the BO-4 jars and try the same it brings the data correctly but adds blank rows at the start of the csv file. The no. of blank rows is the double of no. of rows of data. The data is viewed properly in pdf format.
Can you please help?
Thanks…
LikeLike
Have you tried OutputFormatType.XLSDataCentric?
LikeLike
Yes tried didnot work.
Found a work around took data in .XLSX format. Converted to .csv using poi XSSF.
But now file size greater than 5 mb(default max char stream size in cmc) doesnot work. This is the “file size” I wonder it takes the whole file at once and writes not like .XLS where it use to write line by line.
Also even after changing the setting in cmc it gives Out of memory exception on server as poi’s memory footprints are high.
So can you please try generating a report in bo4 with getContent as .xls and pass this report as input to poi to generate equivalent csv.
LikeLike
Well, I am not acquainted with the SDK, however, I was wondering if the CSV code you provided could surpass the current limitation regarding the standard CSV output which just generates data from the query and NOT from the report itself, besides, the output comes with headers and text qualifiers.
Regards.
LikeLike
No. This code provides the same output that you get from user interface. I.e. you will get content of data provider in CSV.
LikeLike
I see. Thanks for the reply, I wonder why SAP decided to do so … the other day, in order to provide a “workaround” I created specific objects in my universe with decodes, substrings, etc which enabled me to get the desired output, however, still had to treat the resulting csv file taking away header and text qualifiers, this is really annoying and supposed even SDK would not allow us to fix this limiting problem.
LikeLike
Hi.
Very useful.
However, when I have updated my BO 4.0 to SP06 I have the error:
Exception in thread “main” java.lang.NullPointerException
at com.sap.sl.common.impl.FieldImpl.setDateTime(FieldImpl.java:246)
at com.businessobjects.rebean.wi.internal.dp.prompt.FormatNumberHelper.formatStringToField(FormatNumberHelper.java:125)
at com.businessobjects.rebean.wi.internal.dp.prompt.WIPrompt.prepareAnswers(WIPrompt.java:157)
at com.businessobjects.rebean.wi.internal.dp.prompt.WIPrompts.provideAnswers(WIPrompts.java:99)
at com.businessobjects.rebean.wi.internal.WIDocumentInstance.setPrompts(WIDocumentInstance.java:616)
while trying to put date parameter.
Could you please explain why I have got error mentioned aboive?
Thank you in advance.
LikeLike
Pietras,
Did you find a resolution to this? We are having the same issue in 4.1 SP1 Patch 3
LikeLike
Hi Jon
What is the format of the date are you using? Can you give an example of a value?
What is your locale?
LikeLike
Pietras,
We too are having the same issue with trying to set date type parameters. Anyone have thoughts on this? We are upgrading from XIR3 SP3. We never had the issues in that version
LikeLike
Hi,
In my case issue occurred when I used 12 instead of 24 format of a date(‘PM/AM’). After adding AM/PM my app seems to work.
So, I suppose you have to strictly verify the format of date.
LikeLike
Hi There,
I am very new to this, I just want to know how to open specific report and save as html and pdf. I tried to modify this code but as i am new i am struggling a lot.
I started from if i can just log in to cms and it worked fine. my next step was to write code which will say open specific document and save as pdf and html.
Can anybody help me with that. I am using BO 4.0 SP06
LikeLike
Somehow i was able to work that out but it throwing me below error.
Exception in thread “main” com.businessobjects.sdk.core.server.CommunicationException$UnexpectedServerException: The action cannot be performed.
at com.businessobjects.sdk.core.exception.ExceptionBuilder.make(ExceptionBuilder.java:144)
at com.businessobjects.sdk.core.exception.ExceptionBuilder.make(ExceptionBuilder.java:101)
at com.businessobjects.sdk.core.server.common.CommonRequestHandler.afterProcessing(CommonRequestHandler.java:127)
at com.businessobjects.sdk.core.server.internal.AbstractServer.processIt(AbstractServer.java:178)
at com.businessobjects.sdk.core.server.internal.AbstractServer.process(AbstractServer.java:133)
at com.businessobjects.sdk.core.server.internal.InstanceServer.process(InstanceServer.java:94)
at com.businessobjects.rebean.wi.impl.services.AbstractRebeanService.sendRequest(AbstractRebeanService.java:56)
at com.businessobjects.rebean.wi.impl.services.DocumentInstanceManagementServiceImpl.openDocument(DocumentInstanceManagementServiceImpl.java:164)
at com.businessobjects.rebean.wi.impl.services.DocumentInstanceManagementServiceImpl.openDocument(DocumentInstanceManagementServiceImpl.java:78)
at com.businessobjects.rebean.wi.internal.WIReportEngine.openDocument(WIReportEngine.java:430)
at com.businessobjects.rebean.wi.internal.WIReportEngine.openDocument(WIReportEngine.java:439)
at Test.main(Test.java:65)
Caused by: com.businessobjects.sdk.core.server.ServerException: The action cannot be performed.
at com.businessobjects.sdk.core.server.common.CommonRequestHandler.newServerException(CommonRequestHandler.java:260)
at com.businessobjects.sdk.core.server.common.CommonRequestHandler.createAllServerExceptions(CommonRequestHandler.java:238)
at com.businessobjects.sdk.core.server.common.CommonRequestHandler.afterProcessing(CommonRequestHandler.java:121)
… 9 more
Caused by: com.businessobjects.sdk.core.server.ServerException: Load Driver Call: Initialize
at com.businessobjects.sdk.core.server.common.CommonRequestHandler.newServerException(CommonRequestHandler.java:260)
at com.businessobjects.sdk.core.server.common.CommonRequestHandler.createAllServerExceptions(CommonRequestHandler.java:236)
… 10 more
I am not sure i am on right track or not.
Help would be much appropriated.
Thanks,
Tim
LikeLike
Hi Guys,
After a day of struggle was able to solve my problems by myself. Its just had to spend more time in terms of understanding the code. So I am all good to go.
How ever my another question is i want to schedule and email the report in pdf instead of saving in the folder.
Can anyone please tell me how can i modify this code to achieve that. ?
LikeLike
To schedule a report, you should use with Enterprise SDK. You can find examples on BOB, e.g. http://www.forumtopics.com/busobj/viewtopic.php?t=129494
LikeLike
Thank you dmytro,
I have notices that when I am exporting webi reports using java sdk code given above to html I don’t see any charts ans url in my report.
Do you know the reason of that ?
Thank you,
Tim
LikeLike
Hi Tim
HTML is basically text with some styles. To export charts/pictures, you need to export as MHTML, see here https://bukhantsov.org/2013/10/export-webi-to-mhtml/
I am not sure about URLs. Are they not exported or not working?
LikeLike
Hi dmytro,
Thank you for your reply.
I used below code for mhtml.
Reports reports = widoc.getReports();
HTMLView htmlView = (HTMLView) reports.getItem(0).getView(OutputFormatType.MHTML);
FileWriter fw = new FileWriter(“report.mhtml”);
htmlView.getContent(fw,””,””);fw.close();
but it comes up with an error saying widoc cannot be resolves. I have all the libraries included as well.
So don’t know why it is coming up like that. just to try i changes that to doc.getReports(); and worked well. links came up fine but i cant see any chart in that file.
Do you know any particular thing which i am missing ?
Thanks,
Tim
LikeLike
Is it possible to export a parent report to PDF that will also include the child report in the PDF?
LikeLike
Hi,
This is Cool Stuff !
Is there any way to save the reports as pdfs in locales chosen by the user??
Thanks
saaki
LikeLike
Great code, thanks for your effort.
But I have an issue :
When I “setPrompt”, I have an error “failed to execute… WIS10901”
The full code of the query is displayed and looks good.
Then context :
The WebI report works with the prompt values I choose.
The WebI report use one universe which is based on BEx query.
My feeling :
It seems that generated MDX uses references and not values.
Then instead of [!V000002] INCLUDING “SEP 2013” we have to use [!V000002] INCLUDING [0FISCPER].[K42013007] (by example)
Do you have any information on that behavior ?
LikeLike
I replied myself as I have an idea.
This is probably caused by the fact that the argument that has been passed to MDX parser is the value of the lov and not the displayed label…
Then how to manage it ?
Any idea are welcome 😉
LikeLike
Very cool stuff. I tried searching through here to see if this was already asked/answered. Can I refresh a webi and save it back to platform?
LikeLike
see https://bukhantsov.org/2013/01/how-to-run-a-webi-document-and-export-the-result-using/
but instead of exporting just save doc.save()
LikeLike
Thanks dmytro, now I’m having a compile issue with the code. We are using Eclipse with JRE7 and all the BI 4.0 java libraries. Am I missing something? I believe we are getting an error on this line
for (Object object : infoObjects)
LikeLike
You are compiling https://bukhantsov.org/tools/ExportWebiDocument.java, you added all BO libs from the folder [SAP BusinessObjects]\SAP BusinessObjects Enterprise XI 4.0\java\lib to your project? What is exactly the line which do not compile?
LikeLike
I actually have someone else doing the development. They tell me all the BO Libs are added. This is the line we are getting the errors on
HashMap answers = new HashMap();
LikeLike
Strange. Well, then it is not related with BO SDK. Do they have import java.util.HashMap; in the top of the code?
LikeLike
Yes I do see that. I hope my java people know this but what does it take to get the java import file references resolved?
LikeLike
Hi Dmytro,
Thank you so musch for this sample.
However one problem that I am facing with this code is that the exported report (pdf/excel) just has the first page .
The pdf file has the first page and the 2nd page just has the header.
I have tried PaginationMode(Listing and Page ) but it doesnot resolve the issue.
Can you please help??
LikeLike
It’s wonderful that you arre getting ideaws from ths piece of
writing as well as from our argument madse here.
LikeLike
Hi Dmytro,
Firstly thanks for your code. We are able to generate a pdf of our report but the issue is our report has near to 15 columns so in pdf in the first page we have 10 columns and the 2nd page we get the remaining columns. Is there a setting in BO such that all the 15 columns of our reports gets displayed in a single page. How can we achieve this. Thanks for your help.
LikeLike
I’m really impressed together with your writing talents and also with the layout to your blog.
Is that this a paid subject or did you modify it yourself?
Either way stay up the excellent quality writing, it is
uncommon to peer a nice blog like this one these days..
LikeLike
When i am trying to export BO report to CSV through JAVA code ,I am able generate CSV file.
But in the CSV file im getting data provider query name along with column header,that i dont want in my CSV file.
Please help me out in this .
code:
CSVView csvView = doc.getDataProviders().getItem(0).getResultAsCSV(-1);
writeBytes(csvView.getContent().getBytes(), reportName +”.csv”, saveDir + requestId);
In the file im getting “Group number(Unit purchase)” , I dont want the text inside bracket in my CSV.
Please suggest me on this.
LikeLike