Skip to Content

ODATA services developed with SAP Netweaver Gateway can be performance optimized by great deal by keeping few things in mind.

This blog presents best practices that will help developers programming and consuming SAP Netweaver Gateway applications in improving performance.

1. $expand

$expand is used to retrieve data of associated entity types. This is beneficial since instead of making parallel calls for one association, $expand will fetch data in one call.

i. $expand reduces roundtrips from the client to the SAP NetWeaver Gateway server as well as the SAP NetWeaver Gateway server to the SAP Business Suite. As a result, network time is reduced

ii. $expand reduces SAP NetWeaver Gateway server response time and the consumption of resources

2. Data Provider Expand

By default, SAP Netweaver Gateway framework handles generic $expand statement. This requires no implementation effort.  If we take example of $expand on entity Sales Order and its associated entity Sales Order Items, the framework will carry out following steps:

– GET_ENTITYSET call of Sales Order

– For each Sales Order retrieved in above step, GET_ENTITYSET of Sales Order item will be called in LOOP

Instead of using generic $expand, which might not be performance optimized, we have Data Provider Expand. For this, the following methods need to be implemented:

– For reading an entity with an associated entity set (possible use case: you want to read a Sales Order and its associated Sales Order Items):

– /IWBEP/IF_MGW_APPL_SRV_RUNTIME-> /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITY

– For reading an entity set together with an associated entity set (possible use case: you want to read multiple Sales Orders and all associated Sales Order Items):

– /IWBEP/IF_MGW_APPL_SRV_RUNTIME-> /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET

The performance of data provider expand can be better than generic expand depending upon implementation and how data is fetched.

3. $batch

$batch allows bundling multiple requests that can be sent as a single HTTP request to the server through batch requests. Batch requests are submitted as a single POST request. Operations could be a combination of retrieve and/or change set requests.

i. $batch reduces the number of roundtrips between End-user and SAP Netweaver Gateway

ii. $batch reduces the number of roundtrips between SAP Netweaver Gateway server and SAP Business Suite

iii. $batch reduces SAP Gateway server response time and the consumption of resources.

iv. $batch reduces CPU time of the SAP Business Suite in case of Update calls with a single atomic unit of work.

Hence $batch should be used in case more than two calls are made on the entities which are not associated.

4. Deep Insert

A basic deep insert provides the possibility to create single entities deeply. In addition, deep entities can be created in one activity.

Deep Insert thus helps in reducing the number of OData calls made to the SAP Netweaver gateway server and also ensures data integrity.

A prerequisite to use Deep Insert is that the association between the nested structures is defined and navigation possible using $expand

5. Soft state

Soft state mode enables SAP Netweaver Gateway runtime to process several requests in one ABAP application server session, similar to stateful behavior.

This mode is more useful in the applications where initial load involves huge amount of data for a single request. The resources or functionality loaded during the initial load can be reused in the subsequent requests. Hence soft state improve performance of an ODATA service.

6. Delta Query

Delta Query, as name suggests, provides the delta information of the changes occurred. This means only that data will be fetched from the SAP Business Suite that was created/changed/deleted since the end-user last asked.

Delta query thus helps in improving the performance of ODATA service since each time the latest data and update is provided and not full payload. Thus, for client and server performance it can be very useful to always show the current state in a poll-interaction but with the lowest overhead on both client and server

7. $select

This query is used to specify the fields returned in the result set. Restricting the fields will reduce the amount of data.

8. $filter

This query will fetch the subset of result set and thus will reduce the amount of data.

9. $top and $skip

Using $top and $skip will reduce the size of the payload.

10. Generic

i. Always Code in the backend, avoid coding in the gateway server.

ii. Reduce roundtrips between End-user and SAP Netweaver Gateway, SAP Netweaver Gateway server and SAP Business Suite

iii. Avoid fetching more data than will be presented. Reduce the payload size by using ODATA queries

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Joseph Caruso

    Hello Garima,

    Thanks for your post.  When you say that “GW Hub” is no longer recommended, where is that stated?  We just recently went live with Gateway and based on our own research in combination with SAP’s recommendations, we are using a Gateway Hub.  Please elaborate on “Project Black Bird”.

    Thanks,

    Joe

    (0) 

Leave a Reply