Skip to content

Creating an OData Service

Before generating an OData service, you must obtain or create an OData CSDL XML (metadata) file. See Visual Studio Code Commands and Conventions for OData Metadata.

Caution

The initial generated WAR file will not have security enabled. Refer to the -login option and Securing the Generated Service for information on enabling security before production deployment.

Using the Command-Line Tool

You can generate OData services using the csdl-to-war command-line tool. To find the path for this tool, refer to the service generator tool documentation.

Using the Terminal Menu Options

To execute a defined task, use Terminal > Run Task. You can do this with either SAP Business Application Studio or the Visual Studio Code Extension.

Note

Using the Terminal > Configure Default Build Task... menu option allows convenient execution of a designated build task using a keyboard shortcut.

Automatic Database Table Creation

When the generated service is started for the first time, it automatically creates SQL database tables. This doesn't happen when Working with Existing Database Tables or when using the -nodb option.

The -application option is used to determine a table name prefix and the -version option is used to determine a table name suffix as follows:

  • If the major version number is zero, then the name suffix defaults to _MAJOR_MINOR_PATCH, e.g. _0_1_2.

  • If the major version number is greater than zero, then the name suffix defaults to _MAJOR_MINOR, e.g. _1_2.

If the OData CSDL Schema has changed in any way that requires incompatible SQL table definitions, the major or minor version number must be changed (except for pre-1.0.0 versions, in which case any version change will result in new tables). Any existing database tables from previous application versions will remain in the SQL database and you will have to use external SQL tools to delete the old tables or to migrate existing data from the old tables to the new tables.

Note

  • Additive schema changes, such as adding properties or adding entity types, are considered to be backwards compatible, and therefore do not require a version change. Regenerating and redeploying the service will result in additional tables and columns being created as necessary in the target database.
  • Adding properties to entity types in a cache database may require reloading of data into the cache, because data already in the cache tables won't have meaningful values for any added columns.

Multiply OData Services

After you create a single OData Service server, you can edit the tasks.json file. In this file, where the metadata file is mentioned, you can specify multiple metadata files. Separate each file with a +.

Once you complete that, you can use the -package option to include multiple Java package names separated by +. Similarly, the -path option can include multiple context paths, also separated by +, for the corresponding OData services.


Last update: November 20, 2025