Skip to Content
Technical Articles

To get hostname from system alias in SAP Enterprise Portal

Hello,

In SAP Portal, we may across scenario where we need to read the host name from system alias. In my case, I need to setup SSO for EPM add-in. I followed the steps given in SAP note: 2148259.In EPM add-in war file, we need to maintain host name in web app. As we have EPM add-in implemented in two SAP backend systems, we could not maintained hostname in web app.

To overcome this challenge, I followed below steps:
1. As EPM add-in is called using an URL, created an URL iview and passed system alias as a URL parameter.

2. In the EPM add-in war file, to read the system alias from URL and then read hostname using it, wrote below code in EPM_AddIn_Launcher.java in “updateParamters” method.

      String hostName =null;
      String sysAlias = request.getParameter("system");
      ISystemLandscape portalLandscape = UMFactory.getSystemLandscapeFactory().getLandscape(ISystemLandscape.TYPE_ENTERPRISE_PORTAL);
      if(portalLandscape == null) {
         throw new Exception("It seems like no Enterprise Portal is installed.");
      }
      ISystemLandscapeObject systemObject;
      try {
      systemObject = portalLandscape.getSystemByAlias(""+ sysAlias +"");
      hostName= systemObject.getAttribute("wap.WAS.hostname").toString().split(":")[0];
      }

As discussed above, using SAP Portal APIs, you can get hostname from system alias using below 3 steps:

1.   ISystemLandscape portalLandscape =              UMFactory.getSystemLandscapeFactory().getLandscape(ISystemLandscape.TYPE_ENTERPRISE_PORTAL)

2. ISystemLandscapeObject systemObject = portalLandscape.getSystemByAlias(“system alias name in string format”)

3. String hostName= systemObject.getAttribute(“wap.WAS.hostname”).toString().split(“:”)[0]

You can use this solution as per your requirement. Make sure system alias you are passing is correctly configured in System Administration–> System Landscape in SAP Enterprise Portal system.

Regards,

Siddhesh Shewale

/
1 Comment
You must be Logged on to comment or reply to a post.