Show TOC

Mapping the Query OperationLocate this document in the navigation structure


In this step, you will map the QUERY operation based on the GetList BOR method.

Use the QUERY operation to get a list of the business objects to map to your SAP Gateway Service.

You can map specific fields from the selected BAPI to the Query operation. First, set a constant value for the Property, MaxRows.

Setting Constant Values

  1. Select the GETLIST method under the USER object in the data source screen and perform the mapping. See Mapping the Operations.

  2. Right-click MaxRows (left-clicking will remove the selection for the attribute), and then choose Set Constant Value.


    Note that BAPIs and RFCs (which are the basis for these BOR methods) that supply a MaxRows or similar import parameter also allow for an option to limit the number of items returned from the client or consumer at runtime.

    To limit the number of items returned, the runtime consumer or client can include the $top query string parameter according to OData specifications, for example, $top=5.

    If a constant is set for MaxRows and the $top parameter is also provided, the value for the $top parameter will take precedence.

    For example, in order to prevent a large query results, a constant value can be set for MaxRows, for example, set to 100. If a larger result set is required, the $top parameter can be specified in the request.

  3. In Constant Value, enter the value ‘100’ (include the single quotes) and click the check mark to continue.

    Setting the MaxRows attribute with the constant gives the maximum number of items to retrieve in the query results.

    Set a constant value for an attribute

  4. Set another constant using the character ‘X’ for the attribute, WithUsername.

    Setting this attribute with the constant, results in the inclusion of the name field values, such as, FIRSTNAME,LASTNAME,FULLNAME in the query results.

  5. Remove the selection for the nodes, RETURN and SELECTION_EXP.

    The return structure is automatically handled by the generator tool.

  6. Click the check mark to close the Map Operation screen.

Assigning Keys to Operations

The attribute in the data source that has been defined as key must be the Property that you assign as key in the Data Model for the operation.

For BOR and Screen Scraping data sources (unlike RFC data sources), the Data Model automatically assigns a Property of the Query operation as the key.

Using Change Mapping Route in the Map Operation dialog, you can see that the attribute, USERNAME, under the UserList node has been automatically assigned as a key.


Map each operation to the same key.

Mapping Additional Properties to the Query Operation

You can map additional Properties to the Query operation, such as, the SAP ranges tables. This provides additional filtering capabilities or selection criteria when searching for particular users in the system, at runtime.

  1. In the Structure view, right-click the root node and select Add Property.

    Manually adding a Property in the Structure view

  2. Create the new property called USERID of type Edm.string with an appropriate label as shown in below:

    Create new Property USERID

  3. Click Continue.

  4. Add another property called ISLOCKED of type Edm.string with an appropriate label as shown in the image below:

    Create a new Property ISLOCKED

  5. Click Continue.

    You should see both Properties in the Structure view of the Data Model.

  6. Now we want to modify the mapping to take advantage of the supplied range table in the BAPI.

    From the right hand side of the screen, select the QUERY operation and click the Change Mapping button.

    Select the node, SelectionRange, and click Set Range Table.

  7. In the Map Range Table window, click Add.

  8. Select USERID and click the checkmark to continue.

    Range table

  9. In the Map Range Table window, delete the value, P, from the Semantic column for PARAMETER.

    Delete the value "P" in Parameter

  10. In Constant Value, enter ‘USERNAME' (include the single quotes).

  11. Add the following range table parameters:

    • ISLOCKED: For ISLOCKED, set the range table attributes as shown in the image below:

      Range table additional constant values

    • LASTNAME: For LASTNAME, set the range table attributes as shown in the image below:

      Range table additional values for LASTNAME


    Double-click each mapping route parameter to set the respective ranges table attribute.

  12. Click the check mark icon to close the Map Range Table window and click the check mark again to close the Map Operation screen.

    The Create Data Model main screen displays.

  13. Click Generate at the top left corner.

    Generating and saving the Data Model

    The generated status displays the results of the generated models.


    To save your work, you must generate it.


You have successfully mapped attributes for the Query operation from your data source to Properties in the Data Model.

Continue with Add the Data Model to a Consumption Model.