Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

SAP iViews: Portal Components in Java : Page 4

With Eclipse and the SAP Portal Development Kit, you can build and deploy enterprise portlet applications for the SAP Enterprise Portal.


advertisement
Rendering Data from a Non-SAP Data Source
To demonstrate access to a non-SAP system, I use the open source MySQL database as the external data source. However, the programming constructs from this example are valid for all JDBC-compliant databases. As with an SAP data source, you must maintain the connection parameters for third-party systems and remote databases in the portal landscape XML files.

Instead of managing a special data model and using HTMLB to output on a JSP page, this example employs the Portal Data Viewer (PDV) service of the SAP API. The PDV also provides an implementation of HTMLB, but it can render tabular data directly in the EP without JSP programming.

While you can access non-SAP systems with SAP Logon Tickets, another method to enable remote authentication from the EP is via user mapping. In this process, the portal administrator can correlate (or map) a portal user to the ID and password for a remote system. A custom table in the EP's LDAP directory server stores the mapped credentials. At runtime, the Dispatcher class can access this table via the SAP Portal Component API and retrieve the logon credentials. In the following code snippet, KEY is the destination system (here, the MySQL database) that is registered in the portal landscape:



bConn = new backend(KEY); broker.enrich(bConn); un = bConn.getUser(); pw = bConn.getPassword();

Once the Dispatcher class determines the mapped user name (un) and password (pw) for the portal user, you can access the database and query it via the standard connection of the DriverManager:

Connection con = DriverManager.getConnection("jdbc:mysql:///my_db",un,pw); Statement std = con.createStatement(); ResultSet res = std.executeQuery("select * from my_table");

Finally, you set the result from the query (here, res) as the data source for the PDV service, which automatically renders the output in the EP:

ISource pdvSource = portalDV.createSource(request, res); portalDV.setSource(pdvSource);

Figure 4 depicts the PDV output of the MySQL database iView. In addition to its automated rendering mechanism, the PDV service supplies a number of standard features, including column sorting, tabulation, and user personalization.

Figure 4: The Database iView via the Portal Data Viewer

SAP for Web-enabled, Enterprise Java Apps—Who Knew?
The two examples in this article provide the simplest of introductions to portal component development for the SAP EP, but they are enough to get you started with SAP's Portal Component API and the available development tools. While SAP may not be the first name you consider when it comes to Web-enabled, enterprise applications in Java, you might be surprised what you can learn.



Carl Vieregger is a Principal Consultant with IBM Business Consulting Services. Since 1998 he has been a member of the Global SAP Centre of Expertise, based in Walldorf, Germany. His current focus is on portals and portlet application development. Reach him by e-mail at carl.vieregger@computer.org.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date