{"id":7554,"date":"2025-08-23T00:32:40","date_gmt":"2025-08-22T19:02:40","guid":{"rendered":"https:\/\/www.sapewmhelp.com\/?question=ways-to-create-odata-services-in-sap"},"modified":"2025-08-23T00:32:40","modified_gmt":"2025-08-22T19:02:40","slug":"ways-to-create-odata-services-in-sap","status":"publish","type":"question","link":"https:\/\/www.sapewmhelp.com\/?question=ways-to-create-odata-services-in-sap","title":{"rendered":"Ways to Create OData Services in SAP"},"content":{"rendered":"<h3 data-start=\"266\" data-end=\"339\">1. <strong>Using SEGW (Service Gateway Builder) \u2013 Traditional Approach<\/strong><\/h3>\n<ul>\n<li>\n<p>Transaction code: <strong>SEGW<\/strong><\/p>\n<\/li>\n<li>\n<p>Steps:<\/p>\n<ol>\n<li>\n<p>Create a new project in SEGW.<\/p>\n<\/li>\n<li>\n<p>Define <strong>Data Model<\/strong> (Entity Types &amp; Entity Sets).<\/p>\n<\/li>\n<li>\n<p>Map Entities to <strong>ABAP structures\/tables<\/strong>.<\/p>\n<\/li>\n<li>\n<p>Implement CRUD operations in <strong>DPC (Data Provider Class)<\/strong>.<\/p>\n<\/li>\n<li>\n<p>Register and activate the service in <strong>\/IWFND\/MAINT_SERVICE<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u2705 Use Case: Legacy SAP systems, custom OData for ECC or S\/4HANA on-prem.<\/p>\n<\/li>\n<li>\n<p>\u274c Limitation: Manual coding, more effort, less aligned with modern RAP.<\/p>\n<\/li>\n<\/ul>\n<h3 data-start=\"825\" data-end=\"886\">2. <strong>From ABAP CDS Views (Annotation-Based Exposure)<\/strong><\/h3>\n<ul>\n<li>\n<p>Use annotation:<\/p>\n<\/li>\n<\/ul>\n<p>@OData.publish: true<br \/>\ndefine view entity Z_SalesOrder as select from I_SalesOrder { &#8230; }<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>\n<p>The CDS View is automatically published as an OData service.<\/p>\n<\/li>\n<li>\n<p>Then activate the service in <strong>\/IWFND\/MAINT_SERVICE<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u2705 Use Case: Quick and simple OData exposure from CDS Views.<\/p>\n<\/li>\n<li>\n<p>\u274c Limitation: Only read-only services, no transactional behavior.<\/p>\n<\/li>\n<\/ul>\n<h3 data-start=\"1280\" data-end=\"1340\">3. <strong>Using the RAP (RESTful ABAP Programming Model)<\/strong><\/h3>\n<ul>\n<li>\n<p>RAP provides <strong>managed OData services<\/strong> with end-to-end support:<\/p>\n<ol>\n<li>\n<p>Define <strong>CDS Data Model<\/strong> (Root &amp; Projection Views).<\/p>\n<\/li>\n<li>\n<p>Define <strong>Behavior Definition<\/strong> (CRUD operations, determinations, validations).<\/p>\n<\/li>\n<li>\n<p>Create <strong>Service Definition<\/strong> to expose data.<\/p>\n<\/li>\n<li>\n<p>Create <strong>Service Binding<\/strong> (OData V2\/V4) and publish.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u2705 Use Case: Modern SAP S\/4HANA Cloud \/ On-Prem for transactional + analytical apps.<\/p>\n<\/li>\n<li>\n<p>\u274c Limitation: Available only in S\/4HANA and requires ABAP on Eclipse (ADT).<\/p>\n<\/li>\n<\/ul>\n<h3 data-start=\"2674\" data-end=\"2732\">4. <strong>Using SAP Gateway Service Builder + RFC\/BAPI<\/strong><\/h3>\n<ul>\n<li>\n<p>Wrap an RFC or BAPI in SEGW to expose as OData.<\/p>\n<\/li>\n<li>\n<p>Often used in integration scenarios.<\/p>\n<\/li>\n<li>\n<p>\u2705 Use Case: Exposing existing RFC\/BAPIs as REST APIs.<\/p>\n<\/li>\n<li>\n<p>\u274c Limitation: Old-school approach, less future-proof.<\/p>\n<\/li>\n<\/ul>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","question-category":[172],"question_tags":[178,222,221,177],"class_list":["post-7554","question","type-question","status-publish","hentry","question-category-odata","question_tags-abap","question_tags-api","question_tags-odata","question_tags-sap"],"_links":{"self":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question\/7554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question"}],"about":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7554"}],"wp:attachment":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7554"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion-category&post=7554"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion_tags&post=7554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}