We are navigating to the Entity Type that we previously created with the SEGW transaction code. Then we select the ABAP Type Editor. If the Data is grayed out, you should switch to edit mode with the magnifying glass and pencil icon at the top.

After selecting “Explicit Assignment” mode, we entered “Data Element” for Category and “MATNR” for Associated Type in order to use the MATNR Data Element here.

Then we press the “Generate” button. Here, we received a warning because we used a Data Element.

Classes in a service are stored in the “Runtime Artifacts” section.

The names of base classes end with DPC and MPC, while the names of extension classes end with “_EXT”. The ABAP code of base classes is not modified, and extension classes are used instead.


Here, under “Methods > Inherited Methods”, we can find the methods of the Entity Set we used.

Then, in the ABAP Editor, I switch from Display Mode to Edit Mode using the magnifying glass and pencil icon.

From here, I go to the “Signature” section.

I click on the “Type” section of the Entity Set.

Here, we click on this button to go to the code of our Entity List.


Here, we can see the data types of the entity types we have created.
Here, I right-click on the section ending with “_GET_ENTITY_SET” and select “Redifine”.

After that, just like with “Et_EntitySet”, I create “wa_EntitySet”, enter the values, and add “wa_EntitySet” to “Et_EntitySet”.
data wa_entityset LIKE LINE OF et_entityset.
wa_entityset-mat_num = '987'.
wa_entityset-mat_type ='FERT'.
APPEND wa_entityset to et_entityset.
wa_entityset-mat_num = '387'.
wa_entityset-mat_type ='FERT'.
APPEND wa_entityset to et_entityset.
Then, I activate it.

After this is added, when we execute the Entity Set from the SAP Gateway, we receive a green 200 response. And the data inside the Entity Set is now returned.

If the Entity Set is not implemented, we receive this error.

To view the metadata of the service, we add “/$metadata” to the end of the SRV. The “key” tag in the XML provides us with the keys of this entity set. We can also see the used properties in the “Property” tag.

_At the end of “_GET_ENTITYSet”, I am using a SELECT statement to retrieve “matnr” and “mtart” fields from the “Mara” table and assign them to my Entity Set table.
select matnr, mtart from mara into table @et_entityset.

If we want to debug the Entity Set, we can set a debug breakpoint here.

Then, if we execute it from the Gateway Client

We can access the debug screen.

If we want to see the data in JSON format, we can add “/?$format=json” to the end of the Entity Set and execute it.

No Comments