Connecting Cognos reports with external applications

If you ever end up having to use a cognos report on top of another application (say CRM), you could link the external app back to cognos report, at the same time passing the parameter values inside the URL.

If you need to show a report with customer details, your URL would look something simmilar to this:
http://ServerName/cognos8/cgi-bin/cognosisapi.dll?b_action=cognosViewer&ui.object=/content/folder[@name='FolderName']/reportView[@name='ReportName']&run.prompt=false&p_CID=007

where ServerName is your Cognos gateway server, FolderName is the folder where the report is created, ReportName is (yes, you guessed it!) name of the report you are trying to execute.

Now the last part is the interesting one. &p_ is the prefix for parameter and CID is what I called my customer id parameter; anything after = here is the value supplied to the parameter. The above link would show you a report for customer with id 007. Note that unlike in the report query specification, you don't need to have the parameter in between question marks here (?CID?).

If you have more parameters, like date, just continue adding them in the end with a new &p_ prefix for each parameter (&p_Date=20100301).

Another thing is the prompt page. If you want to hide it, then use the &run.prompt=false part of URL, otherwise just remove it, the system should default to showing the prompt page; if not change to true.

The above version of URL is minimalistic- anything that is not needed was removed from the URL. This way it fits weird applications that still have a limit of 250 chars (jeah, I know you thought those don't exist any more! I was just as surprised :) ). In this case also remember, that it's best to have the report somewhere close to the root folder and named as shortly as posssible. You can also have "Shortcuts" folder and create views to original reports there.

Might come across issues with above URL too if your system does not allow [] and @ characters inside URLs. Just substitute them with HEX values. For example @ = %40 More on the HEX codes here.

Have fun linking!
//MxM

P.S. I really want to do some finger pointing- it's SAP that sux so bad that they can't support longer URLs... Now who said this?! ;)

No comments:

Post a Comment