Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Webdynpro ABAP

Data transfer between two UIBB’s

This tutorial explains the data transferring between the Two UIBB’s.

In the earlier created two tutorials we have created feeder class for SEARCH and LIST. If you go through the search application displays the results in its own result table created for the search and the Second application list displays the data which is being initialized in the class.  

I have merged the output of the two previous applications into one. Here I am just going to remove the Result list from the search component and going to display the result in the list we created.



This tutorial explains the two ways of data exchange possibilities. There are even more methodologies which I have saved for later tutorials. For now let’s look at data exchange possibilities between two UIBB’s through.

1.      Static variables of class

2.      Singleton concept

Since we already have the two feeder class modeled lets directly jump into the configuration part by creating a new application and configuring these two types of generic components there.

Step 1: Create an application for OVP Floor plan component.



Step 2: Create application configuration for the application.



Enter the name for the application and click on new to create the application configuration.

clip_image006Enter the description and assign a package for the application configuration.

Step 3: Click on assign configuration name and enter the name for configuration. Click on the link provided for the configuration and create the component configuration.


Step 4: Add a search GUIBB component and enter the name for configuration and configure as below.


Enter the name for configuration and click on configure GUIBB.


Create the configuration and enter the name of the feeder class which was created in the search application.

Click on search criteria to add the search criteria. A pop up will appear with the available fields. Choose the fields required and click on ok.



Note: I have selected all the fields and moved the FLDATE to third position and in general attributes panel I have modified the no of search rows to 3. Also I am not adding columns to result list here.

Step 4: Save and Go back to the component configuration through the breadcrumb navigation available on the top. Add a list UIBB and configure the list UIBB in the same manner with the feeder class created for the list in the List Application.


Enter the name for the configuration and click on configure UIBB. Create a new configuration. Enter the name of the feeder class as that of feeder class created for list application.



Enter the name of the feeder class as below. (Feeder class created for list application)



Select the column button. A pop up will appear with available fields, choose the required layout and click on ok layout will be generated as below.



Step 5: Save the configuration and Clear the code written in the initialize method of list feeder class as I want my list to display data only based on selection criteria.

Test the application. Output of the application appears to be as below.


Now there are two UIBB’s displayed on the screen each on a panel. When the user enters the search criteria and clicks on the search button the data is fetched according to the search criteria and stored in the MT_SFLIGHT attribute of the class ZCL_SEARCH_FEEDER.  Since we haven’t created any output list in the search configuration the result will not be displayed in the search component.

Similarly the second UIBB doesn’t display any record as the attribute MT_SFLIGHT of the table does not contains any value.

Now we have to move the data from Search UIBB to List UIBB.  The feeder class methods of the UIBB’s are called in the sequence they are sequenced in the FPM application.

If you put an external breakpoint on all the methods of feeder class then you can see the sequence in which the methods of feeder classes are being called. Once the screen is displayed and user triggers the action then the sequence of execution is as below.

1.      PROCESS_EVENT method of first feeder class is called (Search)

2.      PROCESS_EVENT method of second feeder class is called (List)

3.      GET_DATA method of search feeder is called

4.      GET_DATA method of list feeder is called

Note: I haven’t considered the FLUSH method here.

In the PROCESS_EVENT method of the search feeder class is the actual place where we are converting the search criteria into select condition and retrieving the data and store it in the internal table MT_SFLIGHT.  MT_SFLIGHT is of type instance attribute, what we can do is change the type of attribute to static so that it can be accessed without the object reference. We can read the data in MT_SFLIGHT in the process event method or GET_DATA method of the List Feeder and store it in the MT_SFLIGHT attribute of the list feeder and hence data in the MT_SFLIGHT will be displayed in the list.

Do the following changes.

Change the attribute type of MT_SFLIGHT in the class ZCL_SEARCH_FEEDER from instance to static attribute.




Change the code in GET_DATA method of the ZCL_LIST_FEEDER as below.

 if iv_eventid->mv_event_id = 'FPM_EXECUTE_SEARCH'.

= zcl_search_feeder=>mt_Sflight.

= mt_sflight.

= abap_true.



Test the application.





Debug the application for better understanding.

What we saw is accessing the static attributes of one class in another class. This is one way of data transportation between two UIBB’s.

We can also achieve the same by creating a singleton class or by wiring between two UIBB’s. Let’s put aside the wiring concept it will discussed in the later chapters. In the same let’s modify the code to access the data by creating singleton class.

Creation of Singleton class:

Step 1: Go to the transaction class builder (SE24) and create a singleton class.



Step 2: In the attributes tab of the singleton class create the attributes as below.





Step 3: Create a method public static method GET_INSTANCE with a returning parameter type referring to the same class.





Write the code inside the method as follows.



Save and activate the class.

Now our singleton class is ready and this class always has only one instance in runtime. We can store the data in this class and retrieve it where ever we want it. I have also created an attribute MT_SFLIGHT in the singleton class for the purpose of storing the result.

Now from the search feeder class we will store the result in the singleton class and from list feeder class we will retrieve the same data from singleton class.

Modify the PROCESS_EVENT method of the search feeder class as below.

  data : lt_where_string type rsds_where_tab.
data : lo_exe type ref to cx_fpmgb.

check io_event->mv_event_id = if_fpm_guibb_search=>fpm_execute_search.

* Convert the search query into sql string


= it_fpm_search_criteria    " search criteria for GUIBB Search
= 'SFLIGHT'                 " Table Name
*    io_field_catalog       =                          " Runtime Type Services
= lt_where_string
catch cx_fpmgb into lo_exe.    " GUIBB Exceptions

*  Exception part handled here


* Fetching the result

select *
from sflight
into table mt_sflight
up to iv_max_num_results rows
where (lt_where_string).

* Storing the data from the singleton class

data : lo_singleton type ref to zcl_singleton.
= zcl_singleton=>get_instance( ).  
->mt_sflight = mt_sflight


Modify the GET_DATA method of the list feeder class as below.

data : lo_singleton type ref to zcl_singleton.

if iv_eventid->mv_event_id = 'FPM_EXECUTE_SEARCH'.

= zcl_singleton=>Get_instance( ).

= lo_singleton->mt_Sflight.

= mt_sflight.

= abap_true.


Now test the application, result is going to be the same, except the approach we transmitted the data from one UIBB to another. This is just a demo application. The advantages and drawbacks of these methods of data transport can be found in the blog link below


About Arun


Post a Comment

Powered by Blogger.