Show TOC

Ranges TableLocate this document in the navigation structure

Concept

A ranges table describes the structure of an internal table for administering complex areas, that is the type of an internal ranges table in the ABAP program.

The row type of a ranges table type has a fixed structure. The row type consists of the 4 components SIGN (sign), OPTION (comparison operator), LOW (lower limit) and HIGH (upper limit) in this order.

The Data Model Generator can recognize ranges table, if they fit the pattern the generator tries to match (that is, it contains HIGH, LOW, SIGN, and OPTION parameters having the defined types). If it recognizes them, all parameters are greyed out together with their settings.

All the table's parameters are greyed out, and their settings are only available on the Map Range Table popup (obtained by selecting the Set Range Table button). Very rarely, the table's parameters may not be greyed out, as the structure is not recognized because fields have different names.

Setting Ranges Table Parameters

Generic ranges tables contain additional parameters, typically, ones that specify for which parameter the range is valid.

If a ranges table is not automatically recognized, or if you want to set a particular table structure as a range table, proceed as follows:

  1. From the Map Operation screen, select the ranges table node by choosing the arrow at the left of the table structure name, and then click Set Range Table.

    The Map Range Table popup displays, split into two sections with Mapping Route at the top and details of the selected mapping route at the bottom (both sections are initially empty).

  2. Choose Add and define a meaningful, valid semantic for each attribute by selecting the icon at the end of the Semantic field.

    The semantic specifies how the field is handled and defines its role in the range expression.

    Mandatory semantics are HIGH, LOW, SIGN, and OPTION according to the ranges table semantics.

    For generic ranges tables, you can also set the semantic Parameter to specify the ranges table attribute that will be filled with the name of the BAPI or RFC parameter for which the range is valid.

    If you mark a range table attribute with this semantic, it will automatically be filled with the name of the data source parameter to which the Data Model Property is mapped.

    In certain cases, populating the range table attribute with this value would not be correct, therefore you can choose to specify constant value(s).

    The semantic is subject to the following validation:

    • Two or more parameters cannot have the same semantic. For example, two different parameters cannot both have the SIGN semantic.

      By default, no semantic value is specified. When no semantic value is specified, you must specify a constant value.

      Place constant values in apostrophes, for example, 'Label'.

    • You cannot set at the same time both the Semantic and Constant Value fields.

  3. Choose the green check mark to save your changes and close the Map Range Table screen.

Choose Reset Range Table in the Map Operation screen. The selected table becomes a generic table type. All the selections are removed for the attributes.

Example

Using an example based on the BOR object, MaintenanceOrderBAPI, you can map the method OrderHeadGetList to the query operation for the Data Model.

The method, OrderHeadGetList, is implemented by the BAPI BAPI_ALM_ORDERHEAD_GET_LIST, which contains an input range table ItRanges. This is a generic range table which can hold selection for various fields.

To enable the runtime SAP Gateway service that will be generated from the Data Model, to perform various tasks, such as, support filtering using Order Enter Date, first obtain details about the method from the documentation for the specific BAPI.

According to the documentation, to support such filtering, the constant value, OPTIONS_FOR_ENTER_DATE should be assigned to the field, FIELD_NAME in the table, ItRanges.

To map the query operation so that it supports such filtering, choose the relevant BAPI, OrderHeadGetList as the data source to map to the Data Model.

  1. In the Map Operation screen, select the range table, ItRanges and choose Set Range Table.

  2. Select Add. A popup with the model structure displays.

  3. Browse to locate and select the property, ENTER_DATE and choose OK.

    The generator attempts to match the range table fields with the fields of the standard ABAP range structure, such as, Sign, Option, High, and Low. If there is a match, the semantic will be provided automatically.

    In this example, the generator identified the range table fields, Sign and Option, and assigned the corresponding semantic, S, and O, to them respectively. For the range table fields, LOW_VALUE and HIGH_VALUE, the generator found no match, so you have to manually assign the semantic, Low and High.

  4. To set the constant value, OPTIONS_FOR_ENTER_DATE, in the range table field, Field_Name, remove any semantic value assigned in the Semantic column, and manually enter the value, OPTIONS_FOR_ENTER_DATE, in the Constant Value column.

    The mapping to support filtering for Order Enter Date is now complete.

  5. Choose the green check mark.

You can follow the above example to enable support for various filtering capabilities.

In addition, you can use the SAP Gateway Generators Cookbook to quickly create a Data Model and test the generated SAP Gateway service using the Data Model Generator tool.

More Information

Examples for using ranges table are available in the SAP Gateway Generators Cookbook.

Mapping the Query Operation.