OData vocabulary annotation interface and methods.
Annotations, labeled elements, and properties can contain elements.
A collection can contain records and simple values. In the code example, a collection is created for an annotation. The collection contains a simple value (string):
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_collection TYPE REF TO /iwbep/if_mgw_vocan_collection. " Vocabulary Annotation Collection lo_ann_target = vocab_anno_model->create_annotations_target( 'Products' ). lo_annotation = lo_ann_target->create_annotation( iv_term = 'Org.OData.Core.V1.OptimisticConcurrencyControl' ). lo_collection = lo_annotation->create_collection( ). lo_simp_value = lo_collection->create_simple_value( ). lo_simp_value->set_string( 'image/jpeg' ).
In the metadata document, this is reflected as follows:
<Annotations xmlns=="http://docs.oasis-open.org/odata/ns/edm" Target="Products"> <Annotation Term="Org.OData.Core.V1.OptimisticConcurrencyControl"> <Collection> <String>image/jpeg</String> </Collection> </Annotation> </Annotations>
Method |
Function |
CREATE_RECORD |
Creates a record |
CREATE_SIMPLE_VALUE |
Creates a simple value |