You are on page 1of 14

Scenario: We have the data displayed in the form of the list all in display mode.

Whenever the user selects a particular row (Lead) then the selected data must be
displayed in the separate form UIBB for editing purpose. We already have the form
UIBB in place created. All we have to do is to transfer data from List UIBB to form
UIBB using wiring concept.
In order to proceed with wiring we need to create two things.
1. Container class
2. Connector class
Container Class: Its nothing but an simple class created for the purpose of storing
data from the source UIBB and reading data from the target UIBB. This class
contains the attributes declared for storing the values. We need not implement any
interface for this class. The container class is instantiated in the source feeder class
and is passed to connector class through feeder model interface
(IF_FPM_FEEDER_MODEL) later the target UIBB receives this reference with the
help of connector class and reads the data.
Connector Class: This class serves as the interface between the Source UIBB and
Target UIBB. This calls implements an interface IF_FPM_CONNECTOR which in
turn implements two other interfaces namely IF_FPM_CONNECTOR_DEF and
IF_FPM_CONNECTOR_RUN. The Connector class gets the instance of the data
container class through (IF_FPM_FEEDER_MODEL) and store the reference in its
attributes. Also it returns the reference of the connector to the target UIBB using the
same interface. Hence the target UIBB is able to access the data container class.
This tutorial is split into Four parts.
1. Modelling the Container class
2.
3.
4.
5.

Modelling the Connector class


Modifications done to list and form feeders to participate in wiring methodology
Creating wires in FPM configuration
Data Exchange between two UIBBs feeder class

Part 1: Modelling the container class


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

Step 2: In the attributes tab of the class declare the necessary attributes to store the
values. Here in this example we are going to store only the lead selected values and
hence I have created an attribute with same structure SFLIGHT.

The role of data container is very limited to data storage and hence I have created
only attributes to store the values.
Part 2: Modelling the connector class
Step 1: Go to transaction class builder (SE24) and create a class.

Step 2: In the interfaces tab of the class, implement an interface


IF_FPM_CONNECTOR. It will also implement two more interfaces,

IF_FPM_CONNECTOR_DEF
IF_FPM_CONNECTOR_RUN

Step 3: In the attributes tab of the class create the following attributes.

This attribute was created to store the instance of the container class provided by the
feeder model interface.
Step 4: Create a class constructor for the class and in the class constructor method
initialize a name space for wiring as coded below.

Step 5: In the SET_INPUT method of the class store the reference of the container in
the attribute created for container class.

Step 6: In the GET_OUTPUT method of the connector class pass the reference of the
container to the returning variable.

Save and activate the class.


Note: Implement all the methods of the class one by one and activate it.
Part 3: Changing the feeder class to be fit for wiring.
We already have modelled the feeder class for FORM and LIST UIBB. In order for a
feeder class to participate in a wiring model it should implement the following
interface IF_FPM_FEEDER_MODEL.
Step 1: In the interfaces tab of both the feeder class list (ZCL_LIST_FEEDER) and
Form (ZCL_FORM_FEEDER) implement the interface
IF_FPM_FEEDER_MODEL.

First lets complete the modifications to be done to the list feeder class and then
proceed to the form feeder class.
Step 2: In the attributes of the list feeder create a reference variable for container
class.

Step 3: In the Initialize method of the List feeder class, instantiate the container class
so that we can assure that our container class gets instantiated only once.

Step 4: In the GET_OUPORT_DATA of the list feeder class, pass the reference of the
container to the connector class.

Step 5: In the GET_OUTPORT method of the list feeder class create the outport type.

Code:
data ls_outport like line of et_outport.
data lr_key type ref to data.
data lv_key type string value LIST_FORM.
ls_outport-type
= LS.
ls_outport-identifier = LIST_TO_FORM.
get reference of lv_key into lr_key.
ls_outport-object_key = lr_key.
ls_outport-description = Data from list to form.
append ls_outport to et_outport.
clear ls_outport.
Step 6: In the GET_NAMESPACE method of the feeder class set the name space for
the wiring model created in the connector class.

Note: Implement all the other method of IF_FPM_FEEDER_MODEL and activate


the whole class.
Thus far in this feeder class we have only created the port for navigation and
container reference to store the data in the container class. We havent written any
logic to access the user selected value and store it in the container class. This part will
be done after wiring is done.
Changes done in form Feeder class
Step 7: Go to the Feeder class for form and do the following.
In the attributes tab of the class create a reference variable to connector class as
shown below.

Step 8: In the set connector method of the feeder class get the reference of the
connector class and store it in the attributes created for connector class.

Step 11: In the GET_NAMESPACE method of the class pass the namespace created
for our connector class.

Note: Implement all the methods of the Interface. Save and activate the whole class.
Part 4: Wiring in FPM application
Step 1: Go to the application ZWDA_DATA_TRANSFER and open the component
configuration we created for that application in the earlier tutorials.

We have three UIBBs which was already created by us. Now we are going to
transport data from LIST UIBB to FORM UIBB. Click on the wire schema tab and
choose the button wire to create the wiring.

Step 2: Fill the values as below. Just choose the target component name and Source
component name using F4 help configuration name will be added by default. Select
the port type as Lead selection and choose the Port identifier from F4 and provide
the connector class.
Note: The port name and port identifier comes from the GET_OUTPORTS method of
the source UIBB.

Save the configuration. Thus wiring is done between two UIBBs. In the graphical
wire editor you can also see the graphical model of wiring.

Thus the wire connection is done between the two UIBB to be build an interface to
exchange data between the two.
Note: An UIBB can be used as target only once, but it can be used as a source as
many no of times. There is only one way a UIBB can be populated.
In the configuration of the list feeder class, the general setting has been modified as
below so as to trigger the event at the time a lead is being selected.

Thus so far we have only created the wiring between two UIBBs. The actual data
transport isnt done yet.
Part 4: Exchanging data between two UIBB.
Step 1: In the process event method of the List feeder class, check the event id for
lead selection and store the value of the lead selected index in the attribute of the
container class.

Code:
DATA : ls_sflight TYPE sflight.
IF io_event->mv_event_id = FPM_GUIBB_LIST_ON_LEAD_SELECTI.
READ TABLE mt_sflight INTO ls_sflight INDEX iv_lead_index.
IF sy-subrc = 0.
mo_sflight->ms_sflight = ls_sflight.
ENDIF.
ENDIF.

Step 2: In the get data method of the Form feeder class with the help of reference to
the connector class get the data from the container class which was stored from list
feeder.

Code:
IF io_event->mv_event_id = FPM_GUIBB_LIST_ON_LEAD_SELECTI.
ms_sflight = mo_connector->mo_data->ms_sflight.
ENDIF.
cs_data = ms_sflight.
ev_data_changed = abap_true.
Output: