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

Data transfer between UIBB's using Wiring Concept

In FPM, a wiring concept is used to build and interface between two UIBB’s for the purpose of exchange of data. At runtime when the data from one UIBB is changed it correspondingly impact the change in values in Target UIBB.

For more information on Wiring:

http://help.sap.com/saphelp_nw70ehp3/helpdata/en/DB/4E8F9861FB43D7BD07B768810CEC98/content.htm

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.      Modeling the Container class

2.      Modeling the Connector class

3.      Modifications done to list and form feeders to participate in wiring methodology

4.      Creating wires in FPM configuration

5.      Data Exchange between two UIBB’s feeder class

 

Part 1: Modeling the container class

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

clip_image002

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.

clip_image004

The role of data container is very limited to data storage and hence I have created only attributes to store the values.

 

Part 2: Modeling the connector class

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

clip_image006

 

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

clip_image008

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

clip_image010

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.

clip_image012

 

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

clip_image014

 

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

clip_image016

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 modeled 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.

 

clip_image018

 

clip_image020

 

First let’s 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.

clip_image022


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.

clip_image023

 

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

clip_image025

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

clip_image026

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.

clip_image028

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 haven’t 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.

clip_image030

 

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.

clip_image032

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

clip_image034

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.

clip_image036

 

We have three UIBB’s 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.

clip_image038

 

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.

clip_image040

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

clip_image042

 

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.

clip_image044

 

Thus so far we have only created the wiring between two UIBB’s. The actual data transport isn’t 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.

clip_image046

 

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.

clip_image048

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:

clip_image050

About Arun

7 Comments:

  1. Many thanks!
    I have a question. I'm trying to exchange data between tree uibb list and a normal list. I implemented your code but when I select a tree line, the event is not called and in method get_data from normal list it's also not called when I select a line from tree. Which cause could be? Thanks.

    ReplyDelete
    Replies
    1. Hi,
      I am not so sure why it did not work. I haven't worked on tree UIBB before. But let me check and post the answer. Check in the configuration of tree UIBB if selecting the tree line is configured to trigger the FPM event.

      Regards,
      Arun K

      Delete
  2. In the U.S., utilities have used aluminum wire for over 100 years. It takes only one pound of aluminum to equal the current carrying capacity of two pounds of copper.visit chrismartslaw.com

    ReplyDelete
  3. Inserting cables through slits can be done easily with hands also but it is recommended to use tool for inserting it efficiently.electrical contractor in voorhees nj

    ReplyDelete

Powered by Blogger.