0% found this document useful (0 votes)
11 views7 pages

OData Service Using REST Class 1745294206

This document outlines the process of creating custom OData services in SAP without using the SEGW transaction, utilizing the standard REST classes CL_REST_HTTP_HANDLER and CL_REST_RESOURCE. It details the steps for developing a REST-based OData service, including creating Z-classes for resource providers and handlers, and registering the service in SICF. The approach provides developers with a lightweight and flexible alternative to traditional SEGW-based development.

Uploaded by

amrithasweety
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

OData Service Using REST Class 1745294206

This document outlines the process of creating custom OData services in SAP without using the SEGW transaction, utilizing the standard REST classes CL_REST_HTTP_HANDLER and CL_REST_RESOURCE. It details the steps for developing a REST-based OData service, including creating Z-classes for resource providers and handlers, and registering the service in SICF. The approach provides developers with a lightweight and flexible alternative to traditional SEGW-based development.

Uploaded by

amrithasweety
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Custom OData Service Using REST Classes (Without SEGW Tcode)

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.

Steps to create OData using Rest Class

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.

A er assigning CL_REST_HTTP_HANDLER in z-class automa cally all methods come under z-


class.
Just double click on get_root_handler method and create object of cl_rest_router class and
used a ach method and pass our z-class ( which we created in step – 1 ) of resource provider
i.e ZCL_ADVPOST_RP to this method.
Step – 5 Create Custom Node in SICF Tcode by clicking on create Host/Service.

Step -6 Enter service name and click on ok.


Step – 7 Enter descrip on and click on save. Do not change anything inside that custom node.

Step – 8 go to Handler list and men oned your created Custom Handler Class ( whci. i.e.
(ZCL_ADVPOST_RH).

You might also like