Three Essential Services of OData Read Service in JSON 

Odata-service

What is SAP Open Data Protocol (OData)?

Open Data Protocol (OData) serves as the default web gateway to access information from different sources. Generally, data is available in different formats, such as HTTP, AtomPub (Atom Publishing Protocol), XML, and JSON (Java Script Object Notation). OData helps developers to access data between frontend and backend or in any other integration scenario. With SAP OData adapter, OData client can have access to OData Service Provider, its data, and metadata. 

OData performs a wide range of operations, including read, create, update, delete, and function import 

This blog attempts to provide a glance into SAP OData Read Service retrieving data, that’s available in JSON format, through: 

Prerequisite:

Input should be below format in the URL. 

$filter=Input eq ‘<Database Table Name>, <Field1>,<Field2>,<Field2>,<Etc..>’ 

$filter=Input eq ‘<Database Table Name>,<Field1=Field value>,<Field2>,<Field2>,<Etc..>’ 

Example – $filter=Input eq ‘LFA1,LIFNR,NAME1,ORT01,REGIO’ 

     $filter=Input eq ‘LFA1,LIFNR,NAME1,ORT01,REGIO=22’ 

Process:

Step1 :

Create an entity type with two fields one for input and another one for output. 

 

Step 2:

Generate run time artifacts and redefine the GET_ENTITYSET method in the DPC_EXT class. 

generate-run-time

Step 3 :

Write the Below code in the Redefined GET_ENTITYSET method. 

Step 4 :

After registering the OData service and loading the information, use the SAP Gateway client to run the OData service. 

run-Odata-Service

Different test cases :

After registering the OData service and loading the information, use the SAP Gateway client to run the OData service. 

Results:

Input – 1:  KUNNR filter 

/sap/opu/odata/SAP/ZB5_KV_DATABASE_TABLE_SRV/Database_fieldsSet?$filter=Input eq ‘KNA1,KUNNR=0000000221,NAME1’ 

Input – 2: NAME1 filter 

/sap/opu/odata/SAP/ZB5_KV_DATABASE_TABLE_SRV/Database_fieldsSet?$filter=Input eq ‘KNA1,KUNNR,NAME1=NK Suppliers’ 

Input – 3: LIFNR filter/sap/opu/odata/SAP/ZB5_KV_DATABASE_TABLE_SRV/Database_fieldsSet?$filter=Input eq ‘LFA1,LIFNR=0000001000,NAME1,ORT01,REGIO 

Input – 4 : Multiple filter 

/sap/opu/odata/SAP/ZB5_KV_DATABASE_TABLE_SRV/Database_fieldsSet?$filter=Input eq ‘LFA1,LIFNR=0000001000,NAME1,ORT01,REGIO=22′ 

Input – 5 : REGIO  filter 

/sap/opu/odata/SAP/ZB5_KV_DATABASE_TABLE_SRV/Database_fieldsSet?$filter=Input eq ‘LFA1,LIFNR,NAME1,ORT01,REGIO=22’ 

 

Input – 6 :  No filter values. 

/sap/opu/odata/SAP/ZB5_KV_DATABASE_TABLE_SRV/Database_fieldsSet?$filter=Input eq ‘LFA1,LIFNR,NAME1,ORT01,REGIO’ 

Input –7 : Wrong field 

/sap/opu/odata/SAP/ZB5_KV_DATABASE_TABLE_SRV/Database_fieldsSet?$filter=Input eq ‘KNA1,KUNN,NAME1′ 

Convert JSON to XML format:

Copy the output from the OData service. With the help of a converter, we can convert JSON to any format. 

Conclusion:

Efficient SAP HANA performance optimization is integral for enhancing data processing. Beyond the opportunities for gaining effective performance benefits, multiple factors impact SAP performance. Addressing those factors and prioritizing performance optimization is essential for sustaining productivity. In addition, systematic performance optimization becomes important in preserving and enhancing the overall value of the business application. Proactively prioritizing optimization efforts helps organizations in securing both the current and future efficiency of their SAP systems.

Share

LinkedIn
Facebook
Twitter
Pinterest

Brief Your Business Needs!

Our team of experienced SAP S/4HANA consultants are available round the clock to solve your existing business complexities.

Receive the latest news in your email

Leave a Reply

Your email address will not be published. Required fields are marked *

Let’s Make Things Happen

Contact Info

sales@erproots.com

+91 6374712657