Adding SAP service data objects

You must configure the SAP JCo adapter in Rational® Developer before using these instructions. If you see the following error message when you try to use the SAP wizards:
Error message when user does not have the SAP Java Connector installed
your adapter may be missing or not configured correctly.

For more information, refer to Setting up SAP development environments.

These instructions will guide you through the process of connecting to an SAP source and specifying either a BAPI or RFM data object for use in your application. To build a command that invokes BAPI, you must know the name of the business object and the name of the method within that object.

  1. Open a Faces JSP file.
  2. From the Data palette, click on either SAP BAPI or SAP RFM and drag it to the JSP file. The Create EIS SDO Object wizard will open.
  3. In the Name field, type the name of your SDO. If you want to reuse existing mediator or metadata information, follow the substeps below; otherwise, click Next.
    1. If you check the box labeled Retrieve and existing record from scope, you can use this wizard to retrieve an existing SAP object from one of the scopes. You must specify both a key name and a scope from which to retrieve. You must also check the box labeled Reuse metadata definition from an existing record or record list and specify the mediator metadata file. Once you enter this information and click Next, you will be taken to a page that displays the schema of the data graph that is a result of interpreting the mediator metadata. On that page, you must select the root feature of the SDO object.
    2. If you only want to reuse information from a previously created object, check the box labeled Reuse metadata definition from an existing record or record list. This will populate the rest of the wizard pages with information collected from the metadata file such as target business functions, selected fields, etc. Note: you will need to have imported the existing metadata file into the project before you can select it via the wizard.
  4. In the Select server connection page, choose a connection from the drop-down menu. If you do not have an existing connection, do the following:
    1. Click Browse.
    2. In the Browse Connections dialogue box, click Add.
    3. In the Create or Edit a Connection dialogue box, enter the values necessary to make a connection to your SAP database server. To enter the SAP host information necessary for the Details field, click Assemble.
    4. Click OK.
    5. In the Browse Connections dialogue box, make sure that your new connection is highlighted; then click OK to return to the Select Server Connection page.
  5. After establishing the server connection, select the main function:
    • If using the BAPI interface, you start with searching the target business object.
    • If using the RFM interface, you can search by the method name or a method group name,
    Enter the necessary information and click Search. Resulting business objects or methods will appear in the window below.
  6. Expand a business object or method and select one of its components to access. Click Next.
  7. In the Select Fields dialogue box, accept the default fields by clicking All; otherwise check the fields that you want to set. Click Next. Required fields are automatically set by the wizard and cannot be changed.
  8. If the main function needs to work in coordination with a pre or post function, use the following sub-steps in the Select Pre and Post Functions window . Otherwise, click Next.
    1. To set pre and post functions, search in the same manner that you searched for main functions (described in step 6). The tree will come up with business objects and methods.
    2. To set the pre and post-functions, click the appropriate button:
      • Pre-function - Pre-function Button
      • Post-function - Post-function Button
      (For example, when using BAPI_ADDRESSEMP_CREATE to create an address record for an employee, you will need to acquire a lock on the Employee record before the create. Then, drop the lock. In this scenario, the BAPI_EMPLOYEE_ENQUEUE is the pre-function and BAPI_EMPLOYEE_DEQUEUE is the post-function.)
  9. In the Configure Mappings page, map the parameter field that uniquely identifies the main function's target record to the parameter field that uniquely identifies the pre or post function's target record. To set the proper mapping to the main function, click the corresponding table cells of the pre or post-function columns; then click Next.
  10. In the Configure Help Values page, the wizard automatically finds out which of the main function's parameter fields need help values and lists them in this table. Each row in the table corresponds to one help values mediator. Use this page to configure the filter criteria of each help value mediator. The options are as follows:
    Mediator Description
    Selection Field Click this to choose the parameter field on the help values data object that will be used to configure the filter criteria
    External Name This is an alias that you set for the internal field corresponding to the one selected in the "Selection Field" cell. It is used in the help values SDO object to identify this field.
    Sign Choose either Inclusive (I) or Exclusive (E) from the drop-down menu. Inclusive (I) - the matched help values will be included in the retrieval result. Exclusive (E) - the matched help values will be excluded in the retrieval result.
    Operator Click this field to select an operator for comparison from the drop-down menu.
    If you skip the configuration in this page, ALL the help values defined for a particular field will be retrieved.
  11. Click Finish. The metadata will be saved to be used at runtime. The SDO data object(s) will be created for the JSP page.
The SDO objects will show up in the "Page Data" view to use with JSF UI creation and configuration.

Editing your SAP SDO

To make changes to the metadata for the SAP mediator you just created, follow these steps:
  • In the Page Data view, right-click on your SAP mediator node and select Configure.

    Configure menu in Page Data view

  • This will activate the SAP mediator wizard that corresponds to this record node.
Related concepts
SAP data access
Related tasks
Setting up SAP development environments
Creating controls and binding with SAP SDOs

(C) Copyright IBM Corporation 2002, 2005. All Rights Reserved.