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: 
0 Kudos
This blog explains in detail how to create a project in Eclipse to get started for developing an OData V4 service based on the SAP Cloud Platform SDK for service development.
It also aims to help you understanding few concepts of the project layout, used by the SDK.
It is part of the series of blogs for beginners see here for prerequisites.

Technologies used:


Create Project

Open Eclipse
From the main menu, choose File -> New -> Project

Then choose Maven Project

Press Next
Leave the default settings

Press Next
In this wizard step, we can select the maven archetype, on which our project should be based.
As you know, the SDK for service development offers an archetype, such that it is easier for us to create an OData provisioning project.
This archetype is called “quickstart”.
It generates a project which is ready for web application development, similar like the standard maven webapp archetype, but on top, it adds some more specific configuration.
the SDK also offers a second archetype called “sample”, which in addition contains code. In this case, the maven concept of archetypes is used to allow users to easily download a sample application (instead of e.g. cloning from git)

Back to the wizard.
In this step we need to solve a problem: the promised quickstart archetype is not listed in the list of existing archetypes
You can verify by typing “odata” in the filter field:


What now…?

The default maven installation doesn’t know about all archetypes in the world.
Even although our desired archetype is located in maven central.

I suggest to solve this problem straight forward:

Press the "Add Archetype" bottom

In the  “Add Archetype” dialog, enter the following data:

Archetype Group Id
Archetype Artifact Id odatav4
Archetype Version 1.17.0
Repository URL



Note that you may adjust the archetype version to the newest released version of the SDK.



Press OK.

Note that this way, an archetype-catalog file is created in your local maven repository.
You can check it at ${user.home}\.m2

don’t get confused: among the standard maven archetypes, there’s also a quickstart called maven-archetype-quickstart, but we don't want that one.

Back on the wizard page, you can now select the quickstart archetype and

Press Next

On this page, you’re supposed to enter the data for your very own and private maven-project that will be generated, so you may enter whatever you like.

The value for hdi-container-service is not needed for most of our tutorials.
It is only required, if the data source CDS is used and as such a respective service instance has to be defined.

After entering a value for the hdi-container-service, it is necessary to press enter or to click anywhere in the dialog, in order to leave the table, which enables the "Finish" button.


Example values:

Group Id com.example.odata
Artifact Id DemoService
hdi-container-service abc


Note that these names will serve as input for generating package and cloud-application names.


Press Finish

The project is generated.



Understanding the project structure


Few words about the generated project layout.
In fact, there’s not much magic:

The normal structure of a java web application project is generated

An empty package has been generated based on our group id and artifact id, as specified before.
Into this package we will (later) create a java class.

An empty “edmx” – folder has been generated, which is used to locate the edmx-files, i.e., model files.
Into this package we will (soon) create an edmx file.

The pom xml is obviously there. It contains the required dependencies for service development with the SDK

A manifest.yml file, which is used for deployment to Cloud Foundry, it might be necessary to adapt it.
But only if you really dare to deploy to Cloud Foundry…



Create model file

Change to your eclipse project and right-click on the edmx folder in oder to create a file into it.
From the context menu, choose New -> File

Enter the file name as DemoService.xml

Then press Finish.
The file is created and is opened in the default xml editor in Eclipse.


Create Java class

Place your mouse pointer on the empty package which was generated by the archetype, open the context menu and choose New -> Class

Then enter a name for the new java class.
The name can be arbitrary, as I mentioned, the framework doesn’t care.
It just needs to be located in that package, that’s important. Even essential.
In my screenshot I’ve given the name  ServiceImplementation

Press Finish.




SAP Cloud Platform SDK for service development: Overview of Blogs and link collection