Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
shivam123ortan
Participant
0 Kudos

Basics

In this blog series, we will cover the fundamental operations involved in building custom SAP Gateway services. These operations include:

  • Get Entity
  • Get Entity Set
  • Update Entity
  • Create Entity
  • Delete Entity

Deep Entity

Additionally, we'll explore more advanced concepts related to deep entities, such as:

  • Get Expanded Entity
  • Get Expanded Entity Set
  • Create Deep Entity

In this blog

  1. Creating the Custom STUDENT Table

  2. Setting up the SEGW Project

  3. Generating Runtime Artifacts

  4. Understanding Runtime Artifacts

    1. ZCL_****_DPC_EXT 
    2. ZCL_****_MPC_EXT 
    3.  ****_SRV 
  5. Conclusion

We'll walk through the process of creating a custom SAP Gateway service using SEGW. We'll start by defining a custom STUDENT table in SE11 and then proceed to create the necessary runtime artifacts to expose this data as an OData service.

Creating the Custom STUDENT Table

  • Navigate to SE11 and create a new table named STUDENT. Ensure that the primary key's data element type is set to 'CHAR' to avoid potential issues later on.

    1.png

Setting up the SEGW Project

  1. Open SEGW and create a new project by clicking on the create icon.

    2.png
  2. Enter the project name, description, and package details.

    3.png
  3. Within the project directory, create an entity type by right-clicking on 'Entity Types' and selecting 'Create'.

    4.png
  4. Specify the entity name and check the 'Create Related Entity Set' option.

    4.png5.png
  5. Double-click on the newly created entity type and enter the table name (ZRO_STUDENTS) in the 'ABAP Structure' column.

    6.png
  6. Right-click on the entity and import the required properties.

    7.png
  7. Select the fields needed and proceed.

    8.png

  8. Designate a primary key field and complete the import process.

    9.png

  9. Verify your project as it will have somewhat below like structure.

    10.png

Generating Runtime Artifacts

  1. Click on 'Generate Runtime Artifact' and leave the model name as default.

    11.png12.png

  2. Following Runtime Artifact will be generated

    13.png

Understanding Runtime Artifacts

We primarily work with the following artifacts:

ZCL_****_DPC_EXT

This class is where we implement CRUD operations, writing ABAP code to manage data flow.

ZCL_****_MPC_EXT

Here, entity type structures are created automatically. This is where we define our Deep Entity Type Structure.

****_SRV

This artifact is consumed in SAP Gateway Interface to create OData services.

Service Registration in SAP Gateway Hub System

  1. Go to Service Maintenance and double click on E8H_000 .

    14.png
  2. Click on Register.

    shivam123ortan_6-1708675278002.png
  3. Enter System Alias as per your configuration in your organization. For me its ‘LOCAL’.

    shivam123ortan_7-1708675306762.png
  4. Enter your package and proceed.

    shivam123ortan_8-1708675326141.png
  5. Click on ‘SAP Gateway Client’ in your service maintenance.

    shivam123ortan_9-1708675334808.png
  6. Now we will be directed to new window with SAP Gateway Client. Here we will check if our project is working fine or has some issues.

    For now just click on Execute and check weather the response has ‘200’ Status code.

    shivam123ortan_10-1708675347369.png

Note

  • When regenerating runtime artifacts, user implementations in ZCL_****_DPC & ZCL_****_MPC classes are reset. Hence, we utilize ZCL_****_DPC_EXT & ZCL_****_MPC_EXT to preserve our implementations.
  • In out next blog we will be move further and discuss the CRUD Operations.

2 Comments
Labels in this area