Show TOC

OData AnnotationsLocate this document in the navigation structure

Capture OData-related aspects to expose data gained from a CDS entity in an OData service.

Scope and Definition
@Scope:[#VIEW, #TABLE_FUNCTION]
Annotation OData
 {
   publish : Boolean default true;
 };
Usage
Annotation Meaning
OData.publish

OData.publish is intended for generating an OData service.

Scope: [VIEW, TABLE_FUNCTION]

Evaluation Runtime (Engine): SADL - Generates the OData service

Values:

Value Description
true

Has to be set to generate an OData service

false

Defines that this CDS entity cannot be exposed for an OData service

Note

When the CDS entity is activated, the OData service is generated automatically. Before you can open and use the OData service, it also needs to be activated using transaction /IWFND/MAINT_SERVICE manually. For further information, see the Related Information below.

You can then start the generated OData service through your Eclipse-based IDE. To do this, choose F2 from the name of the CDS entity that is used in the define view statement. The ABAP Element Information popup is then opened. In the Generated Objects section, the OData Service link is provided. After clicking the link, the default Internet browser is opened and displays its XML code.

Examples

This example demonstrates how you can define the SEPM_I_SalesOrder CDS entity that exposes data to an OData service.

Here, an OData service is generated for the CDS entity. The data is provided from the database table snwd_so.

Sample Code
@OData.publish:true
define view SEPM_I_SalesOrder as select from snwd_so {
	...
}