Currently, almost all SAP developments in web based UIs are moving toward server side rendering e.g. WebDynpros. However, companies like Google, Amazon and Netflix are moving toward developing applications that use more and more client-side rendering. These companies are at the forefront of web technologies; they create new innovative web sites that people love to use. (For those not indoctrinated into GMail, send me an email and I’ll invite you, or check out Amazon’s New Search Engine and/or Google Suggest) These companies are starting to develop web applications with user-interfaces that rival desktop applications. After reading up on how they were built and some reverse engineering of my own, I set out to create an Ajax (see: Ajax Applications) application using SAP data and SAP technologies.
Proof of Concept
I figured I needed to hack together a quick proof of concept, just to make sure I knew what I was doing. The first step was to create a very simple BSP that took in one parameter, a table name, and output an XML document that was the 1st 100 lines of that SAP database table. (Much thanks to Karsten Bohlmann, Christian Fect and Christoph Wedler for writing, “From XML to ABAP Data Structures and Back Bridging the Gap with XSLT.”) Second, I created a “static” web page that used the xmlHTTPRequest object to query the BSP I created and return the XML data to the web browser. Finally, all that remained was to write an XSLT to translate the XML data from the BSP back into presentable HTML and append that HTML back into the static web page.
After finishing the proof of concept, I decided to add one more layer of complexity. I really wanted to be able to use ABAP objects from this new class of applications. (Yes, I could have used web services but those are currently limited to RFC calls. I didn’t really feel like wrapping every class I wanted to use in an RFC.) The result, I hoped, would be the restoration of the fabled 3-tiered architecture. Currently when you run a BSP on a WAS, it becomes both your application server and presentation server, they are in affect one in the same. Writing a way to allow the ABAP objects to exist on the WAS but have the local browser handling the rendering, like my proof of concept, sounded like a good way to fully restore SAP’s 3-tiered architecture.
How to do this became the next interesting challenge, I started reading up on how Java uses RMI to remotely instantiate classes on another VM. I felt this would be the best way to build a reusable framework in ABAP. So, instead of having a simple BSP that takes in just a table name I wrote one that takes in a specially formed XML document. This XML document contained all the information to make a method call on an ABAP object such as class name, method name to call and all its’ parameters. The BSP then breaks up the XML document sent from the web browser, calls the method, then re-assembles an XML document with that methods response, and sends it back to the web browser. Thereby, replacing my simple BSP with what amounts to an RMI server for ABAP objects.
Essentially, this model of using XML and the web browser is a completely different way of creating client-rich, user-friendly web applications in the SAP environment. There are many other details and challenges, as well as how-Tos, that I can post in future blogs depending on interest.