Skip to Content

/wp-content/uploads/2015/03/1_678254.pngHi everyone,


Thanks for tuning in this H2G.


The idea of this “Crash Course” is making preparation steps for the subsequent H2G series about the best practice OData implementation for the Offline store with SAP Gateway. You don’t have to be an ABAP expert – this content is intended for novice ABAP programmers – it should be easy to follow, if you have general understanding & experience in other programming languages.


We’ll build basic OData CRUD services with well-known TravelAgency database table in ABAP system. The OData services will be extended in other H2Gs so that you will be able to gain understanding and experience to build the best designed services for Offline store.


It is easy and – fun 🙂


Applicable Releases


SAP Mobile Platform 3.0 SP5+

SAP HANA Cloud Platform Mobile Services (HCPms)

SAP Gateway SP4+


Step-by-Step Procedure

– Creating a project in Gateway Service Builder

1. Let’s create the project file. Open SAP transaction SEGW. You’ll navigate to SAP Gateway Service Builder. Click on the icon for “Create Project”.

/wp-content/uploads/2015/03/1_678254.png

2. Name your project (this example is “Z_TravelAgency”) and save it.

/wp-content/uploads/2015/03/2_672257.png

3. You’ll see those folders generated.

/wp-content/uploads/2015/03/3_672258.png

4. Right click on “Data Model” and select Import > DDIC Structure.

/wp-content/uploads/2015/03/4_672259.png

5. We’ll generate an entity with “stravelag” structure. Name it “TravelAgency” and enter the ABAP Structure name.

/wp-content/uploads/2015/03/5_672263.png

6. Next screen you’ll choose which columns in the structure you want to generate as OData properties. Select all except MANDT field (In this case, it doesn’t really matter if you keep it or not)

/wp-content/uploads/2015/03/6_672264.png

7. And the next screen let you choose the “Key”. These keys will be used to read/update/delete entity. In this example we just select “AGENCYNUM”.

/wp-content/uploads/2015/03/7_672265.png

8. Now that you’ll confirm those “TravelAgency”, “TravelAgencySet”, and CRUD + Query Implementation are generated – Note that these are still empty. We’ll implement them later steps.

/wp-content/uploads/2015/03/8_672269.png

9. Right click on the project name and choose “Generate Runtime”. This will generate actual OData runtime service code.

/wp-content/uploads/2015/03/9_672270.png

10. Accept all the default values and save it.

/wp-content/uploads/2015/03/10_672271.png

11. After you have done the step above, you’ll confirm the “Method Name” fields are filled out – the template methods are generated.

/wp-content/uploads/2015/03/12_672272.png

12. Find the folder node “Service Maintenance”. In order to run the current OData service we just have generated, we need to configure here. Click it and you’ll see the config pane on the right.

/wp-content/uploads/2015/03/13_672273.png

13. (This might not the same with your screen – this depends on how your Gateway system are deployed) In this screenshot, click on “GW_HUB” and click “Register” button.

/wp-content/uploads/2015/03/14_672274.png

14. You’ll see a popup asking you the alias name.  (Ex. – “LOCAL” – but the value should vary in your system) Once you enter the correct alias name, you’ll see this popup and select your Package Assignment ($tmp).

/wp-content/uploads/2015/03/15_672281.png

15. You should be able to confirm green light

/wp-content/uploads/2015/03/16_672282.png

16. If you see the green light, press “Gateway Client” button.

/wp-content/uploads/2015/03/17_672283.png

17. You’ll see the REST client starts. Just click “Execute” and the response should come back.

/wp-content/uploads/2015/03/18_672284.png

18. In the response payload, you’ll confirm the generated Collection name “TravelAgencySet” and entity name “TravelAgency”. These are all generated out of the ABAP structure.

/wp-content/uploads/2015/03/19_672285.png

19. Now let’s experiment. Add the “TravelAgencySet” in the URL and see what happens.

/wp-content/uploads/2015/03/20_672286.png

20. Yes – as expected, you’ll see the error message. The Query is not yet implemented. We’ll do it in the other chapter.

/wp-content/uploads/2015/03/21_672290.png

What’s next? You can choose either of:

Query operation

Create operation

Read operation

Update operation

Delete operation


List of H2Gs



To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply