For the Query operation, you have to provide one or more filters. For this reason, the filterable properties must be mapped to the data source input parameters of the related BAPI method, or to a range table.
Expand Service Implementation folder, expand the entity set, ProductCollection, and right click the operation, GetEntitySet (Query), and then select Map to Data Source. The Map to Data Source dialog box displays.
In Target System, select Local, in Data Source Attribute select Remote Function Calls, and in Name enter BAPI_EPM_PRODUCT_GETLIST.
Click Continue. The Mapping Screen displays with the Query operation.
The Mapping table displays in the middle of the screen, and the selected BAPI method displays at the right hand side.
Mapping proposals can be provided automatically through the Propose Mapping button where Service Builder finds the mapping information.
Service Builder proposed mapping to fields in the table, HEADERDATA. However, these do not have distinct Input and Output types, so the system cannot automatically determine the mapping direction, and we must manually set the mapping direction in the column, Mapping Direction, by selecting Input/Output from the dropdown list.
Mapping Direction Specifies the direction of the mapping, and describes the data flow direction. An input data flow direction indicates that the service request is mapped into the RFC input parameters, and an output data flow direction indicates that the RFC output is mapped into the service result. The direction is determined based on the data source declaration type as follows:
When the button points to the right, the mapping is of type input. When the button points to the left, the mapping is of type output.
If the data source parameter is an import field, it means the direction is coming from the model to the data source, and the direction is set to input. You cannot change it.
If the data source parameter is an export field, the flow is coming from the data source to the model, the direction is set to Output and you cannot change it.
If the data source parameter is a changing or table parameter, you must decide the direction of flow.
Continue with the section below to manually map the properties to the data source parameters.
Adding Range Table Filter
In BAPI_EPM_PRODUCT_GETLIST, there are three range tables for filtering: Categories, Product IDs, and Supplier Name.
We will use only the Categories range table.
Click Insert Row in the Mapping table. A new empty row is added.
Click in the column, Entity Set Property, of the empty row, and press F4, and then select Categories in the search help.
From the Data Source view on the left of the Mapping screen, select the range table, SELPARAMCATEGORIES , and then drag and drop it into the same row as the property, Categories, in the Mapping table.
We have defined the mapping for the property, Categories, and the range table, SELPARAMCATEGORIES, so that it can be filtered at runtime.
The Map Range dialog displays. This Map Range dialog enables us to assign the semantic of a range.
In our example, a standard selection table is used, therefore the system can automatically determine the semantic; however for a complex table you may require some manual adjustments.
Click Continue to define the mapping.
Adding a Constant Value Filter
To add an additional mapping entry for a constant value:
Click Insert Row.
An empty row is added.
Leave the column, Entity Set Property, empty for the added row, and in Constant Value, enter the character ‘X’ (the entry should include the single quotes).
Drag and drop the parameter, WithUserName, into the same row as the constant value ‘X’ (it is according to the BAPI).
Adding Max Hits Filter
Determine the Max Hits parameter from the data source. We will use the $top filter at runtime in the Query call, so we will automatically assign the Max Hits parameter in the RFC.
From the Data Source view on the right, select the parameter, MaxRows, and click Set/UnsetMax Hits . The icon of the parameter changes, (in our case it is already identified as such).
Click Save to save the mapping for the Query, and assign the model to a transport request.
We have mapped the query operation, added filters, and max hits.
To proceed with the next step in this cookbook, see Mapping the Read Operation.