Show TOC

/IWBEP/IF_MGW_VOCAN_SIMPLE_VALLocate this document in the navigation structure

OData vocabulary annotation interface and methods.

Use interface /IWBEP/IF_MGW_VOCAN_SIMPLE_VAL to create simple values embedded within other annotation artifacts.

If you want to define the existing property IntTest as Integer 42, you can use the following syntax:

Example


DATA: lo_ann_target TYPE REF TO /iwbep/if_mgw_vocan_ann_target,   " Vocabulary Annotation Target

      lo_annotation type ref to /iwbep/if_mgw_vocan_annotation,   " Vocabulary Annotation

      lo_simp_value type ref to /iwbep/if_mgw_vocan_simple_val.   " Vocabulary Annotation Simple Value 

 

lo_ann_target = vocab_anno_model->create_annotations_target( 'Products' ).

lo_annotation = lo_ann_target->create_annotation( iv_term = 'INT Test' ).

lo_simp_value = lo_annotation->create_simple_value( ).

lo_simp_value->set_integer( '42' ).

In the metadata document, this will be reflected as follows:


<Annotations Target="Products" xmlns="http://docs.oasis-open.org/odata/ns/edm">     

    <Annotation Term="INT Test" Int="42"/>    

</Annotations>

Simple value can be of type, string, boolean, integer, path, property path, navigation property path, annotation path, labeled element reference or enum member.

Annotations, properties, collections, labeled elements, and URLs can contain simple values.

SET_NAV_PROPERTY_PATH

This method sets the navigation property path value of the simple value.

SET_LABEL_ELEM_REF

This method sets the labeled element reference value of the simple value.

SET_PATH

This method sets the path value of the simple value.

SET_ANNOTATION_PATH

This method sets the annotation path value of the simple value.

SET_PROPERTY_PATH

This method sets the property path value of the simple value.

SET_ENUM_MEMBER_BY_NAME

This method sets the enum member name as value of the simple value.

SET_STRING

This method sets the string value of the simple value.

SET_INTEGER

This method sets the integer value of the simple value.

SET_BOOLEAN

This method sets the boolean value of the simple value.

SET_DATE

This method sets the date value of the simple value.

SET_DATETIMEOFFSET

This method sets the date time offset value of the simple value.

SET_DECIMAL

This method sets the decimal value of the simple value.

SET_FLOAT

This method sets the float value of the simple value.

With the interface /IWBEP/IF_MGW_VOCAN_SIMPLE_VAL it is possible to create simple values embedded within other annotation artifacts. For example, if you want to define the already existing property "IntTest" as integer 42 you can use the following syntax:
Sample Code
DATA: lo_ann_target TYPE REF TO /iwbep/if_mgw_vocan_ann_target,   " Vocabulary Annotation Target

      lo_annotation type ref to /iwbep/if_mgw_vocan_annotation,   " Vocabulary Annotation

      lo_simp_value type ref to /iwbep/if_mgw_vocan_simple_val.   " Vocabulary Annotation Simple Value 

 

lo_ann_target = vocab_anno_model->create_annotations_target( 'Products' ).

lo_annotation = lo_ann_target->create_annotation( iv_term = 'INT Test' ).

lo_simp_value = lo_annotation->create_simple_value( ).

lo_simp_value->set_integer( '42' ).

In the metadata document this will be reflected as follows:

Sample Code
<Annotations Target="Products" xmlns="http://docs.oasis-open.org/odata/ns/edm">     

    <Annotation Term="INT Test" Int="42"/>    

</Annotations>

The simple value can be of type of one of the following: string, boolean, integer, path, property path, navigation property path, annotaion path, labeled element reference and enum member. Apart from annotations, also properties, collections, labeled elements and URLs can contain simple values.

SET_STRING_FROM_DATA_ELEMENT

This method sets the STRING value of the simple value as a translatable text based on a data element.

Table 1: Parameters

Parameter

Description

IV_TEXT_TYPE

Vocabulary annotation text type (default value is /iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element)

IV_TEXT_ID

Text Id, the name of the data element.

The following text types are supported:

  • data element heading (/iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element_heading)

  • data element quick info (short description) (/iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element_medium)

  • data element long field label (/iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element_long)

  • data element medium field label (/iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element_medium)

  • data element short field label (/iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element_short)

  • data element (default) (/iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element)

Data element text type: If the data element (default) text type is selected, then the text is chosen from the data element according to the following steps:

  1. Take the text from the data element long field label if this text is not initial and the maintained max. length (in se11) for this text is less or equals to 20.

  2. Else take the text from the data element medium field label if this text is not initial.

  3. Else take the text from the data element short field label if this text is not initial

  4. Else take the text from the data element long field label if this text is not initial.

  5. Else take the text from the data element quick info (short description) if this text is not initial.

Sample Code
DATA lo_property      TYPE REF TO /iwbep/if_mgw_vocan_property.     " Vocabulary Annotation Property

DATA lo_record        TYPE REF TO /iwbep/if_mgw_vocan_record.       " Vocabulary Annotation Record

DATA lo_simp_value    TYPE REF TO /iwbep/if_mgw_vocan_simple_val.   " Vocabulary Annotation Simple Value 

 

[...]

 

lo_property = lo_record->create_property( 'Data element from DDIC field' ).

lo_simp_value = lo_property->create_simple_value( ). 

lo_simp_value->set_string_from_data_element(

                        iv_text_type = /iwbep/if_mgw_med_odata_types=>gcs_vocan_text_types-data_element_long

                        iv_text_id = 'SYMSGID' ).

In the metadata document this will reflect as follows (for the language set to English): <PropertyValue Property="Data element from DDIC field" String="Message Class"/>

SET_STRING_FROM_TEXT_ELEMENT
This method sets the STRING value of the simple value as a translatable text based on a text element.
Sample Code
DATA lo_simp_value TYPE REF TO /iwbep/if_mgw_vocan_simple_val. " Vocabulary Annotation Simple Value 

  

lo_simp_value->set_string_from_text_element(

 iv_text_element_symbol = '013'

 io_text_element_container_ref = me ).
Table 2: Parameters

Parameter

Description

IV_TEXT_ELEMENT_SYMBOL

Text element key

IO_TEXT_ELEMENT_CONTAINER_REF

Object reference of the class with text elements

IV_TEXT_ELEMENT_CONTAINER_NAME

The class/report with text elements

SET_STRING_FROM_PROVIDER

This method sets the STRING value of the simple value as a translatable text based on a provider text type. Provide as IV_TEXT_ID an arbitrary STRING that allows the provider application in the context of the corresponding service / annotation file to uniquely identify the corresponding provider text in its text repository.

Table 3: Parameters

Parameter

Description

IV_TEXT_ID

Provider text Id.

SET_STRING_FROM_OTR

This method sets the STRING value of the simple value as a translatable text based on the Online Text Repository (OTR). Provide as IV_TEXT_ID the OTR Id to uniquely identify the corresponding OTR text.

Table 4: Parameters

Parameter

Description

IV_TEXT_ID

Provider text Id.