Advanced OpenDocument Parameters

Monday, June 7, 2010

BI Platform, Tutorials

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>

Related Posts:

  1. Unlocking Your BI Content with OpenDocument
  2. Creating a Pass through Prompt in Designer (Top N, Industry Standards, etc.)
  3. Crystal Dashboard Design (Xcelsius 2008): Tips and Tricks ep5: Parent and Child Dashboards from InfoView using Doc Download!
, ,

This post was written by:

- who has written 21 posts on the Altek Solutions Business Intelligence Blog.


Contact the author

5 Responses to “Advanced OpenDocument Parameters”

  1. Kageg Says:

    Great to know! thanks for the post mate

  2. Anna Says:

    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.

  3. Ryan Muldowney Says:

    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.

  4. Anna Says:

    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.

  5. Anna Says:

    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.

Leave a Reply