SAP NetWeaver Gateway Serie: GET_ENTITYSET Method Implementation

In this serie dealing with SAP Netweaver Gateway Service, we will detail and give some useful and ready to use tips and ABAP sources to start with SAP oData service using SAP GW.

This article will detail the Query to retrieve oData Data Collection: GET_ENTITYSET.

What does the method GET_ENTITYSET do ?

Before starting with GET_ENTITYSET, you may want to check the following articles to have an overview on how SAP Netweaver Gateway works.

A GET_ENTITYSET method corresponds to a QUERY operation that returns zero to many entries. It is responsible for generating the entity collection, and is the equivalent of downloading and synchronizing MBOs.

Each entity has a corresponding service implementation that executes at runtime. You can implement standard operations such as create, read, update, and delete (CRUD) as well as query, to support the maintenance of the entity

The Signature of GET_ENTITYSET SAP Gateway Method

Here the signature of GET_ENTITYSET Method:

Attribute Type Description
IV_ENTITY_NAME STRING The Entity Name
IV_ENTITY_SET_NAME STRING The Entity Set Name
IV_SOURCE_NAME STRING The Entity Source ( if Navigation is used )
IT_FILTER_SELECT_OPTIONS /IWBEP/T_MGW_SELECT_OPTION Table of select options
IS_PAGING /IWBEP/S_MGW_PAGING Paging structure
IT_KEY_TAB /IWBEP/T_MGW_NAME_VALUE_PAIR Table for name value pairs
IT_NAVIGATION_PATH /IWBEP/T_MGW_NAVIGATION_PATH Table of navigation paths
IT_ORDER /IWBEP/T_MGW_SORTING_ORDER The sorting order
IV_FILTER_STRING STRING Table for name value pairs
IV_SEARCH_STRING STRING GW search String
IO_TECH_REQUEST_CONTEXT /IWBEP/IF_MGW_REQ_ENTITYSET All technical information
ET_ENTITYSET generated type from MPC Returning data
ES_RESPONSE_CONTEXT
/IWBEP/CX_MGW_BUSI_EXCEPTION Business Exception in SAP GW mgw
/IWBEP/CX_MGW_TECH_EXCEPTION mgw Technical Exception

Sample ABAP Implementation of GET_ENTITYSET in SAP GW

You find following some useful Implementations of GET_ENTITYSET SAP GW method for Business Partners, Sales Orders and Sales Order Items.
You will have a real cases for Navigation and Filter in SAP GW oData Service.

BUSINESSPARTNERS_GET_ENTITYSET

Here a sample of Implementing the BUSINESSPARTNERS_GET_ENTITYSET Method (source)

SALESORDERS_GET_ENTITYSET

Implement the GET_ENTITYSET method for the SalesOrders entity (source)

SALESORDERITEMS_GET_ENTITYSET

Implement the GET_ENTITYSET method for the SalesOrderItems entity. (source)

Going Further with SAP Gateway Odata Service