Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Introduction


When using a Portal integrated Launchpad such as ESS/MSS, all navigation requests are handled by Launchpad. In the standard solution the navigation requests are passed to the portal integration API which then invokes the Application Integration implementation included in the ERP Common role. For external URLs the navigation target within the ERP Common role is the iView “Launchpad Start URL” with the ID lpd_start_url. The challenge with the standard implementation is that external URLs will be accessed inside a frame. Most web sites such as Google, Yahoo, etc. do not allow their websites to run inside a frame and even if some web sites do, they might not work properly while accessed in a frame.

 

Solution


To overcome the restriction, implement a replacement iView which redirects to the external URL by using Javascript, bypassing the portal completely. NetWeaver Portal 7.31 SPS08 and ERP 6.0 EHP6 SPS04 were used while implementing this solution.

 

Custom Portal Component


 

Create a new Portal Application Project in NWDS. Within the project create a new Portal Application Object. Choose Portal Component of type AbstractPortalComponent. See below for the coding of doContent().

 

You may be required to add servlet.jar as an External JAR into the build path, especially if you get syntax errors for HttpServletRequest.

 

 

Save, Export and Deploy to AS JAVA.

 

Custom iView


Select the new PRT iView (Copy) from the Portal Content Catalog under folder Portal Applications and create a new iView for it (Paste as PCD Object). Name the new iView “Launchpad Start URL”, technical ID lpd_start_url with the prefix com.sap.pct.erp.common.

 

Modifiying ERP Common role


 

Locate the standard “Launchpad Start URL” iView and remove it from the role. Add the custom iView to the role as a delta link. Now locate the standard iView and add also it as a delta link to the role, the iView will automatically be named lpd_start_url_2.

 

Test and verify


For any URL of type EXTERNAL, a proper redirect should now happen bypassing the portal completely. For all other types of URLs the standard iView (lpd_start_url2) will be called.

 

Comments


 

In the standard Launchpad implementation, navigation paths can’t be easily modified. The paths are contained in table APB_LPD_PATHS. SAP note 1757909 introduces customization table APB_LPD_PATHS_C which can be used to override the navigation paths. Even then having custom navigation types is challenging: at least data types and classes need to be enhanced. The approach I have taken has minimal impact on the back-end system but still a standard portal object needs to be modified which means it must be done again in case of system updates.

 


Source Code


Since the migration from SCN to SAP Community sent attachments into a black hole, I'm including the code for doContent( ) in the blog itself.

 
import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import com.sapportals.portal.prt.component.*;

public class Generic extends AbstractPortalComponent {
@SuppressWarnings("unchecked")
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {
HttpServletRequest servletRequest = request.getServletRequest();

if (servletRequest != null) {
String oldUrl = servletRequest.getRequestURL().toString();

Enumeration<java.lang.String> parms = servletRequest.getParameterNames();

String urlTemplate = "";
String navMode = "";
String reqMeth = "";
String windowId = "";
String relNavBase = "";
String tarTitle = "";
String navTarget = "";
String currWindowId = "";
String prevNavTarget = "";
String parmname = "";
String parmval = "";

response.write("<!-- BEGIN OF REQUEST PARAMETERS -->\n");

while (parms.hasMoreElements()) {
parmname = (String) parms.nextElement();
parmval = request.getParameter(parmname);

response.write("<!-- REQUEST PARAMETER: " + parmname + " = " + parmval + "-->\n");

if (parmname.equals("URLTemplate")) {
urlTemplate = parmval;
} else if (parmname.equals("NavMode")) {
navMode = parmval;
} else if (parmname.equals("RequestMethod")) {
reqMeth = parmval;
} else if (parmname.equals("windowId")) {
windowId = parmval;
} else if (parmname.equals("RelativeNavBase")) {
relNavBase = parmval;
} else if (parmname.equals("TarTitle")) {
tarTitle = parmval;
} else if (parmname.equals("NavigationTarget")) {
navTarget = parmval;
} else if (parmname.equals("CurrentWindowId")) {
currWindowId = parmval;
} else if (parmname.equals("PrevNavTarget")) {
prevNavTarget = parmval;
}
}

response.write("<!-- END OF REQUEST PARAMETERS -->\n");

String newUrl = "";

if (urlTemplate.length() > 0) {
if (navMode.equals("1")) {
// redirect to URLTemplate only for URLs of type EXTERNAL
newUrl = urlTemplate;
} else {
// for other URL types redirect to standard implementation com.sap.pct.erp.common.lpd_start_url_2
navTarget = navTarget.replace("com.sap.pct.erp.common.lpd_start_url", "com.sap.pct.erp.common.lpd_start_url_2");
newUrl = oldUrl + "?RequestMethod=" + reqMeth + "&NavMode=" + navMode + "&URLTemplate=" + urlTemplate + "&windowId=" + windowId + "&RelativeNavBase=" + relNavBase + "&TarTitle="
+ tarTitle + "&NavigationTarget=" + navTarget + "&CurrentWindowId=" + currWindowId + "&PrevNavTarget=" + prevNavTarget;
}
response.write("<script type=\"text/javascript\">\n");
// response.write(" alert(\"Old URL was " + oldUrl + "\");\n");
// response.write(" alert(\"Redirecting to URL " + newUrl + "\");\n");
response.write(" document.location = '" + newUrl + "';\n");
response.write("</script>\n");
}
}
}
}
15 Comments
Labels in this area