Show TOC

/IWBEP/IF_MGW_VOCAN_SIMPLE_VALLocate this document in the navigation structure

Use

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.

Use

Methods available for /IWBEP/IF_MGW_VOCAN_SIMPLE_VAL

Method

Function

SET_NAV_PROPERTY_PATH

Sets NAVIGATION PROPERTY PATH value of simple value

SET_LABEL_ELEM_REF

Sets LABELED ELEMENT REFERENCE value of simple value

SET_PATH

Sets PATH value of simple value

SET_ANNOTATION_PATH

Sets ANNOTATION PATH value of simple value

SET_PROPERTY_PATH

Sets PROPERTY PATH value of simple value

SET_ENUM_MEMBER_BY_NAME

Sets ENUM MEMBER NAME as value of simple value

SET_STRING

Sets STRING value of simple value

SET_INTEGER

Sets INTEGER value of simple value

SET_BOOLEAN

Sets BOOLEAN value of simple value

SET_STRING_FROM_DATA_ELEMENT

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:

  1. Take the text from the data element long field label if this text is not initial and the maintained max. length (in transaction 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.



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.



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.

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.

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.

Parameter

Description

IV_TEXT_ID

Provider text Id.