OData Service Using REST Class 1745294206
OData Service Using REST Class 1745294206
Introduc on
In modern SAP development, crea ng custom OData services without relying on the SEGW
transac on. SAP provides two powerful standard REST framework classes
CL_REST_HTTP_HANDLER (resource handler) and CL_REST_RESOURCE (resource provider)
which enable developers to build custom RESTful services, including OData-like services,
without using SEGW.
This document outlines the approach of developing a REST-based OData service using these
two standard classes. It walks through the crea on of custom handler classes, service
registra on, and response forma ng using ABAP, providing developers with a lightweight and
flexible alterna ve to SEGW-based development.
Note: Ini ally we create two z-class and assigned standard rest class CL_REST_RESOURCE
And CL_REST_HTTP_HANDLER in superclass sec on of z-class.
Step- 1 create z-class for Resource Provider in se24. (use RP-Resource Provider at the end of
class name that will help us to iden fy class easily).
Step- 2 A er crea ng class you can assigned standard Resource Provider Rest class i.e.
(CL_REST_RESOURCE) in superclass sec on.
A er assigning CL_REST_RESOURCE in z-class automa cally all methods come under z-class.
Just double click on Post method and you can write your logic.
Step- 3 create z-class for Resource Handler in se24. (use RH-Resource Handler at the end of
class name that will help us to iden fy class easily).
Step-4 A er crea ng z-class you can assigned standard Resource Hadler Rest class i.e.
(CL_REST_HTTP_HANDLER) in superclass sec on.
Step – 8 go to Handler list and men oned your created Custom Handler Class ( whci. i.e.
(ZCL_ADVPOST_RH).