SAP provides a number of Generic User Interface Building Blocks (GUIBB ) generic building blocks such as Tabs UIBB , Form , and List UIBB . These allow you to reuse them into your applications without programming from scratch. In this recipe, we will see how we can add a list GUIBB in our applications.
The GUIBB list must have an associated feeder class that provides the data that is displayed in the list. We will add the list GUIBB in OIF application created earlier. We will add the GUIBB list in a new subview within the component configuration.
Within the list, we will display the columns showing the employee information based on our previously created structure (in Chapter 14, Web Dynpro for ABAP) ZST8_EMPLOYEE_ADDRESS as shown in the following screenshot:
For adding the list GUIBB in our applications, proceed as follows:
SE24
. On the Interfaces tab, we will add two interfaces IF_FPM_GUIBB_LIST
and IF_FPM_GUIBB_LIST_EXT
interfaces (the IF_FPM_GIUBB
interface will come by itself).GET_DEFINITION
and GET_DATA
.GET_DEFINITION
. We first call the DESCRIBE_BY_NAME
static method of the CL_ABAP_TYPEDESCR
class in order to get the details of the structure ZST8_PERNR_ADDRESS
. The reference returned is stored in the defined reference variable MYSTRUCTDESCR
.CREATE
method of the CL_ABAP_TABLEDESCR
class is called and the returned reference is stored in EO_FIELD_CATALOG
.GET_COMPONENTS
method in order to get the components of our structure ZST8_PERNR_ADDRESS
. The components returned in the internal table MY_COMPONENT_TAB
. A loop is then run on the internal table. For each component, we set the properties as visible, read-only, and the column header to be used from the data dictionary definition. The property information is set using the structure WA_FIELD_DESCRIPTION
which is then appended to the internal table (exporting parameter) ET_FIELD_DESCRIPTION
.GET_DATA
method, for our requirement we only need to make very small code insertion. For simplicity sake, we assume that the data that is to be displayed in the list is available in the internal table IT_ADDRESS
(the coding for fetching this data is not shown). The two lines to be inserted are shown as follows:ZST_LIST_CONFIG
) and click the Configure UIBB button on the right-hand side of the screen (note the component FPM_LIST_UIBB and view LIST_WINDOW are inserted automatically).ZST8_LIST_CONFIG
.GET_DEFINITION
method to be available for list configuration. We will use the Add Columns button in order to select the columns that we need to be shown in our list. We may change the header description also if we like and well as the displayed length and sequence.We first define the feeder class using the transaction SE24
. The code is written for the two important methods GET_DATA
and GET_DEFINITION
. Both these methods are called each time the GUIBB is processed.
The GET_DEFINITION
method has two exporting parameters that are filled within the code that we have written. The list of columns that are to be made available in the configuration editor is specified in the exporting parameter EO_FIELD_CATALOG
, whereas, the properties of each column is specified in the exporting parameter ET_FIELD_DESCRIPTION
. The properties that are set include the column heading that may be later changed at the time of configuration.
Within the GET_DATA
method that provides the data to be displayed, the exporting parameter CT_DATA
is filled with data. The statement for setting the value of EV_DATA_CHANGE
to ABAP_TRUE
must be there. If not, the data will not be displayed, however, the list columns are displayed correctly upon application run.
The configuration is then done. We create the configuration of the list UIBB and assign it the newly created feeder class. The GUIBB is attached to a new subview of our existing application.
Upon executing the application, the list is displayed along with the data.
There are other notable methods of the feeder class such as GET_PARAMETER_LIST
, used to define parameters for your feeder class, the NEEDS_CONFIRMATION
method that allows us to display a data loss dialog box, and the PROCESS_EVENT
method that is used for handling any events triggered during the application execution.
At the minimal, coding must be entered in the mandatory methods GET_DEFINITION
and GET_DATA
.
3.135.196.172