
| Target System | Local |
| Data Source Type | Remote Function Call |
| Data Source Name | BAPI_EPM_SO_GET_LIST |



| Target System | Local |
| Data Source Type | Remote Function Call |
| Data Source Name | BAPI_EPM_SO_GET_DETAIL |


| RFC Field (right –hand side) | Entity Property |
|---|---|
| SO_ID | SoId |
| NOTE | Note |
| BUYER_ID | BuyerId |
| BUYER_NAME | BuyerName |
| CURRENCY_CODE | CurrencyCode |
| GROSS_AMOUNT | GrossAmount |
| NET_AMOUNT | NetAmount |
| TAX_AMOUNT | TaxAmount |

In any Read Operation we also need to provide the primary key of the underlying entity as an input parameter. For this we have to manually add a new line to the mapping screen.
1. Choose the Append Row pushbutton:

2. On the new line press F4 to select the entity set property. Double-click SoId to select the entry:

3. Expand the SO_ID node from the tree on the right-hand side:

4. Drag&Drop the RFC field SO_ID (from node SO_ID) to the newly-created line:

5. This performs the mapping on the input parameter (Sales Order ID to fetch the Sales Order details): 
Now we can move on with mapping the Query operation for the Sales Order Item entity-set
1. Expand the node Service Implementation -> SalesOrderItemCollection and right-click GetEntitySet (Query) and select Map to Data Source:

2. In the Map to Data Source dialog box, enter the following values and choose Enter:
| Target System | Local |
| Data Source Type | Remote Function Call |
| Data Source Name | BAPI_EPM_SO_GET_DETAIL |

3. There is again no default mapping because the data model has been built based on a different RFC module. Expand the ITEMDATA node from the tree on the right-hand side:

4. Drag&drop the following fields from the right-hand tree to the Data Source Parameter column of the grid in the middle of the screen:
| RFC Field (right –hand side) | Entity Property |
|---|---|
| SO_ID | SoId |
| SO_ITEM_POS | SoItemPos |
| PRODUCT_ID | ProductId |
| NOTE | Note |
| CURRENCY_CODE | CurrencyCode |
| GROSS_AMOUNT | GrossAmount |
| NET_AMOUNT | NetAmount |
| TAX_AMOUNT | TaxAmount |
| QUANTITY | Quantity |
| QUANTITY_UNIT | QuantityUnit |

5. In the Direction Column set all fields to Output. Choose Enter:

6. Choose Append Row button:

7. From the input help, select SoId for the new line:

8. Expand the SO_ID node from the right-hand tree:

9. Drag&drop the RFC field SO_ID (from node SO_ID) to the newly created line:

Now we are done with the data provider mapping (at least for the Query and Read operations we need). Now we can re-generate the runtime artifacts and run our OData service.
1. Choose the Generate pushbutton:

2. Verify that the runtime objects have been generated successfully:

3. Start the Gateway Client (Transaction /IWFND/GW_CLIENT) in a separate window to run the service. Provide the following URI to get the Sales Order Collection. This executes the query method of the Sales Order entity-set:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection

4. Choose any sales order entry and use the URI to navigate to the sales order detail, for example:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection('0500000001')

5. Get the related sales order line items via the following URL:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderItemCollection/?$filter=SoId eq '0500000001'

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 47 | |
| 22 | |
| 18 | |
| 16 | |
| 15 | |
| 14 | |
| 14 | |
| 14 | |
| 13 | |
| 13 |