Show TOC

OData Vocabulary Annotations APIsLocate this document in the navigation structure

Use

Use vocabulary annotations to extend your OData services. Annotating an OData service enables you to add information that tells the clients of your service how they should interpret the service and its data. You can use annotations to add semantics that describe certain behavior that is applicable to a particular artifact, such as creatable, updatable, or sortable, for example. Annotations also enable you to provide further information such as which fields form an address or which fields logically belong together.

For example, if you have an OData service that is integrated with a mobile device to provide contact details and phone numbers, you can use annotations to tell the client which of the OData properties in this service contain the contact's details such as name and address and which properties contain a phone number.

Support of Conditional Expressions

You can use the capabilities of dynamic expressions for UI field control. The following expressions are available: IF, =, <>, >,>=, <, <=, AND, OR, NOT

Example:

<Property Name="Reiseland" Type="Edm.String">
  <Annotation Term="Common.FieldControl">
    <If>
      <Eq>
........<Path>Auslandsreise</Path>
        <Path>Active</Path>
    /If>
  </Annotation>
</Property> 

Different subtypes:

  • IF: Condition, then, else

  • Not: One child

  • Other: Two children

  • Works with inline and annotation file

/ iwbep/if_mgw_vocan_cond_exp = /iwbep/if_mgw_vocan_annotation->create_con_exp(  /iwbep/if_mgw_med_odata_types=>gcs_con_expression_operator- )
/ iwbep/if_mgw_vocan_cond_exp_p = / iwbep/if_mgw_vocan_cond_exp-> create_parameter( )
/ iwbep/if_mgw_vocan_cond_exp_p->
CREATE_SIMPLE_VALUE()
CREATE_CON_EXPRESSION()
CREATE_RECORD()
CREATE_FUNCTION()
CREATE_LABELED_ELEMENT()