In a previous post, I explained the basics of using the OpenDocument function in BusinessObjects to link directly to BI content. This article covers two of the more advanced topics: passing prompt values to OpenDocument and using the SDK to login behind the scenes.
Passing Prompt Values to OpenDocument
When a report is refreshed, the user must answer all required prompts. You can pass prompt values in the URL to prevent the user from having to see the prompt dialog box. There are several parameters you can use to satisfy prompts on a document, depending on what type of prompt you are dealing with.
- lsM[Name] — Used to specify a prompt with multiple values, such as an “In List” or “Not In List”
- lsS[Name] — Used to specify a prompt with a single value, such as “Equal to” or “Greater Than”
- lsC — Used to specify a document context
- lsR[Name] — Used to specify a prompt with a range of values (Crystal Reports only)
The value [Name] is the name of the prompt as entered in Query Panel. This must match exactly for OpenDocument to find and fill this prompt. The lsM and lsS parameters will be the ones you use most often. The only gotcha is with the lsM parameter — values must be enclosed in brackets [ ] and separated by commas. Here is an example using both parameters:
http://<servername>:<port>/OpenDocument/opendoc/openDocument.jsp?
sDocName=World+Sales+Report&lsSEnter+Year=2010
&lsMEnter+States=[Pennsylvania],[Maryland]
This is where OpenDocument becomes very powerful. For example, you can combine this with report variables on a WebIntelligence report to pass data from the report as a prompt value to OpenDocument. This allows you to “drill-through” from a summary report to a detail report. You can do similar things from Xcelsius, the BusinessObjects SDK, or external software programs.
Logging in Behind the Scenes
OpenDocument allows you to pass a logon “token” in the URL, which represents an existing BusinessObjects session, meaning the user does not have to log into BusinessObjects. This is perhaps the most used yet most advanced option. Using the SDK, you can log in to BusinessObjects “behind the scenes”, then pass the token to OpenDocument.
Implementing this feature will take a bit of programming knowledge. The powerful SDKs included with BusinessObjects provide you with several methods for logging in and obtaining a logon token. The most common method would probably be using the Enterprise SDK. Using the following Java code, you can generate a logon token for the given username. If the user is already logged into a website by another means, you can use this method to also log them into BusinessObjects. Simply retrieve the user information from the session and pass it into the method below. For more on implementing this solution, view the SDK Developers Guide available on the SAP Help Portal.
String openDocumentToken() throws SDKException, UnsupportedEncodingException {
IEnterpriseSession sess = CrystalEnterprise.getSessionMgr().logon ("username", "password", "<cms>:<port>","secEnterprise");
String token = sess.getLogonTokenMgr().createLogonToken("",120,100);
String tokenEncode = URLEncoder.encode(token, "UTF-8");
return (tokenEncode);
}
Once you have your logon token, you can pass it to OpenDocument using the token parameter.
http://<servername>:<port>/OpenDocument/opendoc/openDocument.jsp?
sDocName=World+Sales+Report&lsSEnter+Year=2010
&lsMEnter+States=[Pennsylvania],[Maryland]
&token=<token>
As long as that token remains valid, the user will not be prompted to log into BusinessObjects when clicking the OpenDocument link. This provides the user with a seamless experience — they may not even realize that they are jumping into BusinessObjects when they click the link.
Edit: Commenter Anna below pointed out that the documented method for using the lsM parameter does not work. We found that with Web Intelligence, prompt values should be provided without brackets and be delimited by semicolons. In that case, the example above would look like this:
http://<servername>:<port>/OpenDocument/opendoc/openDocument.jsp?
sDocName=World+Sales+Report&lsSEnter+Year=2010
&lsMEnter+States=Pennsylvania;Maryland
&token=<token>



Monday, October 25, 2010 at 9:24 am
Great to know! thanks for the post mate
Wednesday, March 16, 2011 at 1:40 am
Hi Ryan,
Thanks for posting.
I have setup the filter variable correctly (In List&Prompt). I was able to run successfully in infoview when entering multiple value. (ie. entering value ‘x01′,’x02′&’x03′ ). It gives the correct result.
I tried to sent URL to BO ….&lsMAccExecId=[x01],[x02],[x03].
Instead of recognising as 3 entries, BO recognise it as 1 entry “[x01],[x02],[x03]“. Therefore give no result.
Anyone has experience with this? Any tips or resolution on this ?
Thanks for your help.
Wednesday, March 16, 2011 at 4:03 pm
Looks like my example (and the SAP documentation) is actually wrong in this case. You should use semicolons without the brackets, like so:
&lsMAccExecId=x01;x02;x03
I’ll update the post to reflect this, thanks.
Wednesday, March 16, 2011 at 7:45 pm
Hi Ryan,
Thanks so much for your help. It works now with semi colon.
Yeah, even the BO Manual/SAP documentation was wrong.
Really appreciate your prompt & accurate answers.
Best Rgds.
Friday, March 18, 2011 at 2:44 am
With the Opendoc url, user able to see the “Refresh button” & “User Prompt Input” on the left panel.
Is there parameter or anyway to avoid user to refresh the report ?
Thx & Rgds.