Skip to Content

Having dynamic XSS homepage/areapages seems to be a common requirement for many enterprise portal implementations. In an example scenario, you will see how all the static service links in the Self Service Homepage and area pages can be made visible and invisible dynamically by using one simple Proxy class and one RFC which contains all the dynamic page rules. This way you will be able to create and maintain complicated dynamic XSS Homepage and area pages easily. 

The Self Service Homepage framework configuration can be found here, just in case. 


0. Example Scenario

Let’s assume we have defined two static services (Z_SERVICE1 and Z_SERVICE2) and have assigned them to an area page. Each service has one link resource that points to an application. So each employee gets two service links in the area page. However, the links should be only displayed to some employees. Here I define two very simple rules for the dynamic area page:  

Rule 1: Display Z_SERVICE1 to employees with personnel number starting with 1.
Rule 2: Display Z_SERVICE2 to employees with personnel number starting with 2.

You can define any rules with several services and use the same proxy class that is used here.

 
1. Create the Proxy Class:

1.1 In the ABAP workbench, create a class (I call it ‘ZCL_XSS_PROXY_DYNAMIC’) and implement the interface ‘IF_XSS_SER_PROXY_SERVICE’. Three methods will be created for your class automatically under the ‘methods’ folder:  GET_SERVICES, GET_SERVICE_DATA, and SET_CONTEXT_PARAMETERS.


1.2.
Add the following attributes to the proxy class:

image


1.3.
Fill in the method SET_CONTEXT_PARAMETERS with the following lines:


1.4.
Fill in the method GET_SERVICES with the following lines.


1.5.
Leave the body of GET_SERVICE_DATA empty. 


2. Create the Service Availability RFC           
 
The method SET_CONTEXT_PARAMETERS calls an RFC named ‘Z_GET_SERVICE_AVAILABILITY’. This RFC will basically contain all the dynamic page rules. The RFC imports the personnel number and the service name and it exports a Boolean value determining if the service is available for the employee or not. In our simple example, the RFC will look like the following:

All dynamic page rules can be implemented in this RFC. For instance, you can hide the services based on the organization units, cities or pay scale types. To show a service, set the showservice parameter to true based the conditions that the rule states, and obviously to hide it set the showservice to false. 


3. Use the Proxy class in the services

The last step is to add the proxy class name to the service definition. Before adding the proxy class, the service should be defined and work properly for all users. The proxy class applies the availability rule which is defined for the service.

image

 
4. How does it work?

Briefly, the first time the user goes to XSS home page the framework initializes all instances of the services that are assigned to the homepage and area pages. To initialize the proxy services first it calls the method SET_CONTEXT_PARAMETERS. In that method the Service availability RFC is called and the showservice attribute of the class is set based on the rules. Then the framework calls the method GET_SERVICES of the proxy class. This method adds the service to the list of services only if showservice is true. Simple!


5. Another Option

It is also possible to implement and use one proxy class for each service and implement each rule in one proxy class. It just sounds more convenient to implement and manage all the rules in one place (Service Availability RFC) and assign one proxy class name to all services than implementing many classes and having each rule in a different class. However, the performance might slightly improve if you implement a separate proxy class for each service.

To report this post you need to login first.

8 Comments

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

  1. Christopher Solomon
    I have had to do this several times…especially around Benefits in ESS…ie. Making enrollment links visible/active dynamically. Using SAP own standard example for Annal/Any-time enrollment really helped! I would say a very thorough understanding of the Homepage Framework will work wonders for anyone who jumps into this.
    (0) 
    1. Amir Madani Post author
      Thanks for your comment! I just needed to add, this implementation of proxy interface is a little bit different from the standard implementations. In fact, for any requirement (even active/inactive service links) you can just use this proxy class with no changes and put your rules in the Service Availability RFC. So even someone without deep knowledge about the Homepage Framework Proxy Classes can take advantage of this feature and build dynamic homepages using this implementation.
      (0) 
    2. Remi Kaimal B
      I was going through the blog “Create Dynamic XSS Homepages with Static Services Using a Simple Proxy Class” to see your reply. And i understand that you have worked on creating a service for Benefits in ESS.
      I am right now, developing custom services in ESS using Floor Plan Manager.
      But benefits uses repetitive structures.
      Is there any work around.
      Regards,
      RK
      (0) 
  2. Andreas Mau
    How can I achieve to create a popup in the area menu? Currently I am hooking into FM HRXSS_SER_GETMENUDATA and am trying to use
          CALL FUNCTION ‘WDY_EXECUTE_IN_PLACE’
            EXPORTING
    *         PROTOCOL                  =
              internalmode              = ‘X’
              SMARTCLIENT               = ‘ ‘
              application               = ‘ZFITV_GE_EMPLOYEE_POPUP’
              CONTAINER_NAME            = ‘HTML’
    *         PARAMETERS                =
    *         SUPPRESS_OUTPUT           =
    *       IMPORTING
    *         OUT_URL                   =
            CHANGING
              VIEWER                    = lo_viewer
            EXCEPTIONS
              invalid_application       = 1
              browser_not_started       = 2
              action_cancelled          = 3
              OTHERS                    = 4.

    This ends in a short dump. Any change in the combination of parameters internalmode, smartclient and container name is either not showing anything or it ends in a short dump with CNTL_ERROR and RFC_…ERROR. When I call my FM separately outside the ESS framework it creates a WebDynpro popup just fine.

    Any hints wuld be very helpful.

    (0) 

Leave a Reply