HI,
I have developed the Annotation project and redefined the method DEFINE_VOCAB_ANNOTATIONS with below code, how to call the below code in my main service.
My Requirement is to display the description of MATNR as ARTICLE CODE, Please let me know what I am missing here.
Please let me know if there is any code i have to written to get the
data: lo_ann_target type ref to /iwbep/if_mgw_vocan_ann_target. " Vocabulary Annotation Target "#EC NEEDED
DATA: lo_annotation TYPE REF TO /iwbep/if_mgw_vocan_annotation. " Vocabulary Annotation "#EC NEEDED
DATA: lo_collection TYPE REF TO /iwbep/if_mgw_vocan_collection. " Vocabulary Annotation Collection "#EC NEEDED
DATA: lo_function TYPE REF TO /iwbep/if_mgw_vocan_function. " Vocabulary Annotation Function "#EC NEEDED
DATA: lo_fun_param TYPE REF TO /iwbep/if_mgw_vocan_fun_param. " Vocabulary Annotation Function Parameter "#EC NEEDED
DATA: lo_property TYPE REF TO /iwbep/if_mgw_vocan_property. " Vocabulary Annotation Property "#EC NEEDED
DATA: lo_record TYPE REF TO /iwbep/if_mgw_vocan_record. " Vocabulary Annotation Record "#EC NEEDED
DATA: lo_simp_value TYPE REF TO /iwbep/if_mgw_vocan_simple_val. " Vocabulary Annotation Simple Value "#EC NEEDED
DATA: lo_url TYPE REF TO /iwbep/if_mgw_vocan_url. " Vocabulary Annotation URL "#EC NEEDED
DATA: lo_label_elem TYPE REF TO /iwbep/if_mgw_vocan_label_elem. " Vocabulary Annotation Labeled Element "#EC NEEDED
DATA: lo_reference TYPE REF TO /iwbep/if_mgw_vocan_reference. " Vocabulary Annotation Reference
*Calling the generated mehtod for creating annotations
CALL METHOD super->define_vocab_annotations( ).
lo_reference = vocab_anno_model->create_vocabulary_reference( iv_vocab_id = '/IWBEP/VOC_CORE'
iv_vocab_version = '0001').
lo_reference->create_include( iv_namespace = 'Org.OData.Core.V1' ).
lo_reference = vocab_anno_model->create_vocabulary_reference( iv_vocab_id = '/IWBEP/VOC_CAPABILITIES'
iv_vocab_version = '0001').
lo_reference->create_include( iv_namespace = 'Org.OData.Capabilities.V1' ).
lo_reference = vocab_anno_model->create_vocabulary_reference( iv_vocab_id = '/IWBEP/VOC_COMMON'
iv_vocab_version = '0001').
lo_reference->create_include( iv_namespace = 'com.sap.vocabularies.Common.v1' ).
lo_reference = vocab_anno_model->create_vocabulary_reference( iv_vocab_id = '/IWBEP/VOC_COMMUNICATION'
iv_vocab_version = '0001').
lo_reference->create_include( iv_namespace = 'com.sap.vocabularies.Communication.v1' ).
lo_reference = vocab_anno_model->create_vocabulary_reference( iv_vocab_id = '/IWBEP/VOC_UI'
iv_vocab_version = '0001').
lo_reference->create_include( iv_namespace = 'com.sap.vocabularies.UI.v1' ).
*Creating the Annotation Target
lo_ann_target = vocab_anno_model->create_annotations_target( iv_target = 'ZXXX_LINKXXX_SRV.Article' ).
*Creating the LineItem Collection
lo_annotation = lo_ann_target->create_annotation( iv_term = 'com.sap.vocabularies.UI.v1.LineItem' ).
lo_collection = lo_annotation->create_collection( ).
**Creating the Records
* Article Number
lo_record = lo_collection->create_record( iv_record_type = 'com.sap.vocabularies.UI.v1.DataField' ).
lo_property = lo_record->create_property( iv_property_name = 'Value').
lo_simp_value = lo_property->create_simple_value( ).
lo_simp_value->set_path( 'Matnr' ).
lo_property = lo_record->create_property( iv_property_name = 'Label').
lo_simp_value = lo_property->create_simple_value( ).
lo_simp_value->set_string( 'Article Code' ).
Thanks
Shaik