Passing Dynamic Parameters to Applications via the Application Integrator
Say that you want to call an application (could be a SAP Application like a BSP or a custom web application) in the Enterprise Portal using the applicaton integrator. Additionally you want to pass some parameters to this application to control its behaviour or content. However, you cannot simply enter them to the ‘Additional Parameters’ field at design time because the value of the parameters should be dynamic – in other words, you should be able to fill the value of the parameters when calling the iview at runtime.
The solution is the DynamicParameter, which is a kind of ‘wrapper’ parameter inside which you can bundle parameter-value pairs. When you add the DynamicParameter to a call to an appintegrator iView at runtime, the appintegrator parses the value and includes the contained parameters in the redirect to the application. Note that the DynamicParameter can be passed in different ways, depending on how you call the iview. For instance, you can include it as a parameter in a programmatic navigation (using EPCM.doNavigate()). In this blog, I consider the case where you are calling the iview using a direct URL (and the NavigationTarget syntax).
1. Append the DynamicParameter parameter to the URL used to call the iView, setting it’s value to the set of key-value pairs you want to send to the iView, e.g.
http://<portal.domain.com>:<port>/irj/index.html?NavigationTarget=ROLES://<pcd_location_of_iView>&DynamicParameter=param%3Dvalue%26param2%3Dvalue2 . This should pass the parameters param=value and param2=value2 to the iView. Note that as the DynamicParameter element is itself a parameter in the QueryString, it is necessary to URL encode the ‘&’ (%26) and ‘=’ (%3D) characters within the DynamicParameter string.
2. If the iView is located on a page, you have to edit the page and add an asterisk (* ) in the field ‘Parameters to Pass for Page Request (for URL Isolation)’. This ensures that the DynamicParameter parameter is passed from the page to the iView.
3. Note that for appintegrator.Generic iViews, the DynamicParameter parameter is not by default taken into account when building the URL to the webapplication. You have to change the URL template property to effect this: You do that by entering the DynamicParameter in the ‘URL Template’ property of the iView which isused by the component to build the target URL, e.g. using something like: <System.protocol>://<System.server>:<System.port><System.uri>?<DynamicParameter>.
As an example, let’s create a Generic appintegrator iview for the IMDb web page, then call the iView and pass the name of a film you want to search for in the URL to the iView. (Note: if you search for ‘Jaws’ the URL you are redirected to at IMDb is http://www.imdb.com/find?s=all&q=jaws).
1. First, create the system object where we configure the http access point for IMDB: Go to System Administration > System Configuration > System Landscape and create a new Web Application system object (right click on a folder, and select New > System (from template) > Web Application. After creating the object with an appropriate name and id, open it for editing and enter the following values under the System Definition property category:
2. Under the User Management property set, we set the Logon method to ‘SAPLOGONTICKET’ to avoid being prompted for user mapping when launching an iview based on this system.
3. In the dropdown at the top right of the image above, we change from the ‘Object’ aspect to the ‘System Aliases’ aspect, and create a suitable alias for the system, e.g. ‘IMDB_system’.
4. Next we create a new Generic appintegrator iview: Go to Content Administration > Portal Content, browse to the folder where we want to create the iview and select New > iView, then select Portal Component as the creation type, and choose com.sap.portal.appintegrator.sap as the Portal Archive and Generic as the Portal Component.
5. After creating the iview, we edit it and under the ‘Content – Generic Launcher’ property set enter the values as following (note the full value for the URL Template is ‘<System.protocol>://<System.server>:<System.port><System.uri>?<DynamicParameter>‘):
6. We can now call this iView using the NavigationTarget syntax:
http://portal.domain.com:50000/irj/portal?NavigationTarget=roles://portal_content/test/test_role/imdb_iview&DynamicParameter=s%3Dall%26q%3Djaws. To modify the behaviour we can add the required parameters to the DynamicParameter querystring parameter, so for instance if we’re interested in classic shark-related shocks, we can instruct IMDB to search for ‘Jaws’ by appending ‘&DynamicParameter=s%3Dall%26q%3Djaws’ to the above URL, resulting in: http://portal.domain.com:50000/irj/portal?NavigationTarget=roles://portal_content/test/test_role/imdb_iview&DynamicParameter=s%3Dall%26q%3Djaws, with the below result when calling the iView: