Skip to Content

BSP: Data exchange between (sub)Controllers – Part II (using OO Design Patterns )

I would like to introduce the basic concept of Object Oriented Design Pattern  “Program to an Interface, not an implementation” in our application.

To make the application in Part I more flexible, create an interface ZIF_DATA_EXCHANGE, with method signatures  GET_CUSTOMER_ID and SET_CUSTOMER_ID with customerid type string as parameter. The objective of the interface is to provide methods that will be implemented by the classes (controllers)  to exchange the data .  In our case all of the controllers are going to implement the interface depending on the method of data transfer.

Implement the interface in, so that the methods in the interface are available for redefining in the controllers for implementation.

Now, consider the three methods of data transfer explained in PART I.

Method 1.

1.Create an attribute CUSTOMERID in

2.Redefine methods SET_CUSTOMERID and GET_CUSTOMERID in as below.

Now get the instance of the interface that was implemented in and code to the interface as per Design Patterns.

3.     In DO_HANDLE_EVENT of LIST.Do capture the row selected event and set the parent controllers attribute CUSTOMERID with customer id of selected row by calling the interface method SET_CUSTOMERID implemented in

4.     In DO_INIT_ATTRIBUTES of, get the customer id from parent controller that was set by the list selection event.

Get the customer details based on me->customerid to display in the page. 

Method 2. (Push Method)

The rowselect event in accesses the implementation class in and sets the attribute’s value in

Assumption is that the component id for details list is defined as ‘detail.

1.     Interface ZIF_DATA_EXCHANGE should be implemented in controllers as shown.

In implement the interface method SET_CUSTOMERID  should be as shown below to set the customerid attribute in controller.

Method 3. (Pull Method).

This is implemented in DO_INIT_ATTRIBUTES of . Gets the attribute from by using the implementation method in parent controller Assumption is that the component id for details list is defined as ‘list’.

In implement the interface method GET_CUSTOMERID  should be as shown below to get the customerid attribute .

In all of the above methods, only instance of Interface methods are obtained not the instance of concrete class( as in Part I ) methods. If another application were to call directly, with out changing the code in, the calling application can set the attribute by implementing interface ZIF_DATA_EXCHANGE .
Be the first to leave a comment
You must be Logged on to comment or reply to a post.