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:
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.
This method sets the navigation property path value of the simple value.
This method sets the labeled element reference value of the simple value.
This method sets the path value of the simple value.
This method sets the annotation path value of the simple value.
This method sets the property path value of the simple value.
This method sets the enum member name as value of the simple value.
This method sets the string value of the simple value.
This method sets the integer value of the simple value.
This method sets the boolean value of the simple value.
This method sets the date value of the simple value.
This method sets the date time offset value of the simple value.
This method sets the decimal value of the simple value.
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: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>
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.
This method sets the STRING value of the simple value as a translatable text based on a data element.
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:
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.
Else take the text from the data element medium field label if this text is not initial.
Else take the text from the data element short field label if this text is not initial
Else take the text from the data element long field label if this text is not initial.
Else take the text from the data element quick info (short description) if this text is not initial.
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"/>
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 ).
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 |
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.
Parameter |
Description |
---|---|
IV_TEXT_ID |
Provider text Id. |
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.
Parameter |
Description |
---|---|
IV_TEXT_ID |
Provider text Id. |