Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 



You should have done the following steps:


#1 - OData CRUD Crash Course - Getting ready with offline store


Step-by-Step Procedure


- Building Query operation

1. In SAP transaction SEGW, expand a project folder and open TravelAgencySet. Click on GetEntitySet (Query) and choose Go to ABAP Workbench.

2. As the first implementation, you'll see the popup.

3. Click on the *_DPC_EXT folder. The right pane should show the Class Interface shown in the next step.

4. You'll see the list of the methods. Scroll down - click and focus on the "..._GET_ENTITYSET" and press the Redefine icon.

Tip: Make sure if your editor is in edit mode with the icon. Redefine icon is .

5. Here's the generated code from the superclass. Delete the commented out lines of code.

6. You have an empty implementation now.

7. If you click "Signature" text, you'll see the in & out parameters of this method. We'll implement so that it returns "ET_ENTITYSET" parameter.

Here's implementation:

   Naming convention:
   l - local variable
   t - table
03   DATA: lt_entityset TYPE TABLE OF stravelag.
05   SELECT * FROM stravelag INTO TABLE lt_entityset.
07   et_entityset = lt_entityset.
09 endmethod.

#03 defines a variable which holds the TravelAgency table contents. #05 loads the database table "stragelag" that contains the TravelAgency data into the local variable. #07 sets the value in the predefined output parameter "et_entityset" - as you see in the Signature pane, the data type is already generated as a TravelAgency structure "..._MPC=>TT_TRAVELAGENCY".

Those tiny 3 lines of code does the database access and returns the TravelAgency collection in OData - how simple & powerful is that? 🙂


Make sure you activate it by icon.


- Testing Query operation


Start your favorite REST Client tool - this one is using Firefox RESTClient. In this step, you should have seen the actual URL of the OData service. Type it in the REST client URL with HTTP GET.

The Query result should come in correctly!


What's next? You can choose either of:

- Create operation

- Read operation

- Update operation

- Delete operation



List of H2Gs