Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

SAP Enterprise Portal is a very extensible tool that can integrate every kind of information sources, one way or another. It’s actually a presentation layer which has many development tools that we may enrich via custom coding or third party tools & frameworks.

 

In this blog, I will not talk about what Web 2.0 is; or what AJAX brings to our browsers; however I will make a small application that combines the power of Portal coding, javascript and xmlhttprequest-base object for AJAX- in order to ajax-enable the SAP Portal.

 

Actually, this application was born as a response to one of my clients’ request. They want to be notified before the portal will be shut down, while navigating or just entering the data in the portal. In order to do that with classical browser applications, a round-trip to server should be made, and a server application should check to see if there’s some data about the restart of the portal; however our application should work even if the user do not click a link, a button etc.; therefore it should work behind the scenes.

 

I start building an AJAX application that connects to the server (behind the scenes) and get if there’s a time for restart and prompt the user with this time.

 

For reminding the user at any moment, the application should work like a daemon in operating systems. Providing this functionality will be the problems after we develop our AJAX call application.

 

 

The basic idea is like that, however there will also be other extensions and problems to solve; but before working with this, let’s cut this talk and see some action.

 

For the coding, I start with creating an abstract portal component. In this component the only thing I will do is making an AJAX request to call the URL that reads the data and tells me the next restart time of the server.(Portal Administrator will feed the datasource) .

 

For the base of the AJAX request call, I modified the code that I get from Manning, AJAX in Action book (http://www.manning.com/crane/) which is a successful one, and put it all together in a method-ajaxify. So whenever I call the ajaxify method, it makes an AJAX request and returns the result for me. The javascript behind this method is as follows

 

 

The code can be used in any AJAX application therefore I will explaing this javascript a little before the second part of the blog.


In the script, the whole magic is wrapped within ajaxify method that takes 5 parameters :

 

url is called via ajax request.

method is the form method either GET or POST

qs is the querystring parameters that we want to pass to the URL  

callbackFunction is called after successfully returning the result of the call

errorFunction is called if there’s an error with the request/response.

 

You just have to call ajaxify function, create a function like returnFunction(request) to continue the process and a function like handleError(request) to process the error. In return function request.responseText is the result from the AJAX call. You can do whatever you want with this data afterwards. That’s simple isn’t it?

 

Ajaxify Your Portal : Restart Reminder (part 2) I will continue with the creation of my application, embed it in my portal and extend it with some functionality and user parameters to increase usability.