Skip to Content
Technical Articles
Author's profile photo Vishal Kumar

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

 

  • 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).

 

 

    • 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)

    • After completing this step all the Entity, Entity Sets, Association & corresponding Navigation is automatically generated in the Gateway Project.

 

    • 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.

 

    • We can execute the service with different Entities to see the results.

 

 

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 !! 🙂

 

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo SRIRAM KOMPELL
      SRIRAM KOMPELL

      Thanks for the Blog Vishal! Intresting one Indeed!!. One question here. Can we add few more additional fields(Custom Fileds) in the Model level of SEGW ? is it possible?

      Regards

      Sri Ram