4

Creating OData Service based on Referenced Data Source using SADL framework

 1 year ago
source link: https://blogs.sap.com/2022/10/17/creating-odata-service-based-on-referenced-data-source-using-sadl-framework/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
October 17, 2022 2 minute read

Creating OData Service based on Referenced Data Source using SADL framework

This blog post will provide the steps to implement an OData service using SADL framework and how to reference an SAP ABAP CDS view in SEGW Gateway Builder.

Introduction

As a developer, we are already familiar with the Gateway Service Builder (SEGW) tool, also we know the different ways to create and model an OData service.

Just to list down the different approaches to create and model an OData Service.

  1. ABAP code-based service Implementation.
  2. Service Adaptation Description Language (SADL) framework
    1. Mapping Editor
    2. Referenced Data Source
  3. Annotation based approach

SADL framework – A model-driven approach using ABAP CDS Views to create OData service.

Enough of theory, lets jump into the system and see how this is created.

Steps

** For the purpose of demonstration, I will use a standard CDS view – A_BillingDocument

blog-5.jpg
  • Create Gateway Project in Gateway Service Builder (SEGW)

    • Project – ZSADL_BILLINGDOCUMENT created.
    • To create the Data Model, we need to refer to Data Source. (CDS View in this case).
blog-2.jpg
blog-6.jpg
    • In the next screen, we can see all the elements of CDS entity and corresponding Associations.
    • Select all the elements and proceed further. (We can select only the fields which are relevant for as per Business Need and we always have the option to edit that later)
blog-8.jpg
    • After completing this step all the Entity, Entity Sets, Association & corresponding Navigation is automatically generated in the Gateway Project.
blog-9.jpg
    • Now, generate the service.
    • After generating Register and Maintain the service. As like any OData service 🙂
  • Test in Gateway Client (/IWFND/GW_CLIENT)

    • Once the service is maintained, it can be tested in the Gateway Client.
    • We can see all the Entity and corresponding Association in the Metadata Information.
blog-10.jpg
    • We can execute the service with different Entities to see the results.
blog-11.jpg

Summary

  • The advantage of using the SADL framework with Referenced Data Source is that Mapping (Association & navigation) is derived automatically.
  • With this approach change in the OData model is not supported but changes can be done in the SADL model and that reflects in the OData model.
  • Also, field extensibility and custom code exits are possible.

So, using this approach OData service implementation can be optimized!

Please feel free to comment and let me know your feedback.

Happy Learning ….Together !! 🙂


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK