Creating controls and binding with SAP SDOs

Use JavaServer Faces controls to bind SAP SDOs and populate help values.

After the SDO data objects are created for the Faces JSP page, they are ready to be bound with JSF controls. The easiest way to create the UI is by dragging and dropping the SDO data object from the "Page Data" view.

 

SDO Data Objects Created for Different Types of Mediators

For each WPAI mediator one or two SDO data objects are created. Please refer to the table below to find out how many SDO data objects will be created:

SDO Mediator Type Action Number of SDO Data Objects Created
SAP function execution 2
SAP help values retrieve with selection criteria 2
retrieve without selection criteria 1
When there are two SDO data objects, one is for the parameters and the other is for the results. You should drag and drop all objects from Page Data view to the Faces JSP page to create and bind with UI controls. For SAP function mediators, SDO objects that represent input parameters to the function are always empty initially and need to be bound to JSF UI controls so that they become populated with parameter data.

 

Creating JSF UI by Dragging and Dropping the SDO Data Objects

  1. In the "Page Data" view, expand the top level data node corresponding to the SDO mediator, to reveal the SDO data objects.

  2. Drag and drop the SDO data object to the Faces JSP page and release at the desired location. A dialog box will appear that allows you to choose the following:

    • If you dropped an SDO that represents input parameters to the function, then select the radio button labeled "Creating a new record."

    • If you dropped an SDO that represents output parameters from the function, click the radio button labeled "Display an existing record."

  3. Based on the corresponding SDO data object field's data type, determine what type of controls to create. For instance, for a boolean type a check box control is more suitable than a text input field.

  4. Click OK to confirm the UI creation.

 

Modifying the UI Controls

After creating your JSF UI controls, You can make further modifications to the controls, such as creating a different type of control, change the binding etc. This is necessary especially with function parameter fields that need help values. These are the fields which only takes a list of values predefined by the server. The list of values are available in the result SDO data objects from the help values mediator.

To modify the bindings for a parameter field requiring help values, follow the steps below:

  1. In the Faces JSP page, if the control created for the parameter field is not a combo box, delete it and drag and drop a combo box control from the palette.

  2. Select the new combo box control. To modify its binding, use its Properties view.

  3. In the "h:selectOneMenu" tab, click the Add Set of Choices button.

  4. After the new row has been added to the table, click a cell of the "Value" column to activate editing for this cell. Click on the button to launch the dialog for selecting the target data object.

  5. Navigate the tree to find the item for the help value's mediator, expand it until you see the "value" item.

  6. Select the "value" item and click "OK".

  7. Click inside the cell again to change the segment ".value.value." to ".help.value.". Press the "Enter" key to confirm the changes.

  8. Save the Faces JSP page.

 

Related concepts

SAP data access

 

Related tasks

Setting up SAP development environments
Adding SAP service data objects