Show TOC

Base Class: Annotation Provider ClassLocate this document in the navigation structure

The generated base class always inherits its code from /IWBEP/CL_MGW_PUSH_ABS_MODEL which in turn inherits from /IWBEP/CL_MGW_ABS_MODEL. The base class generated: CL__Project Name_APC will have redefinition for DEFINE (), GET_LAST_MODIFIED () and DEFINE_VOCAB_ANNOTATIONS () methods.

DEFINE()

Unlike MPC, in APC the Define () method will invoke Define_Vocab_Annotations( ) that creates annotation target.

Sample Code

A sample code for the Define () method for the sample model is provided below for reference:

method DEFINE.
*&---------------------------------------------------------------------*
*&           Generated code for the MODEL PROVIDER BASE CLASS          &*
*&                                                                     &*
*&  !!!NEVER MODIFY THIS CLASS. IN CASE YOU WANT TO CHANGE THE MODEL   &*
*&        DO THIS IN THE MODEL PROVIDER SUBCLASS!!!                    &*
*&                                                                     &*
*&---------------------------------------------------------------------*

define_vocab_annotations( ).
endmethod. 
Note

For define_vocab_annotations( ) method call there will be a corresponding method implementation in the same class with appropriate details.

GET_LAST_MODIFIED () Method

A sample code for Get_Last_Modified method is provided below for reference:

method GET_LAST_MODIFIED.
*&---------------------------------------------------------------------*
*&           Generated code for the MODEL PROVIDER BASE CLASS          &*
*&                                                                     &*
*&  !!!NEVER MODIFY THIS CLASS. IN CASE YOU WANT TO CHANGE THE MODEL   &*
*&        DO THIS IN THE MODEL PROVIDER SUBCLASS!!!                    &*
*&                                                                     &*
*&---------------------------------------------------------------------*


  CONSTANTS: lc_gen_date_time TYPE timestamp VALUE '20140605173628'.                  "#EC NOTEXT
  rv_last_modified = super->get_last_modified( ).
  IF rv_last_modified LT lc_gen_date_time.
    rv_last_modified = lc_gen_date_time.
  ENDIF.
endmethod. 
DEFINE_VOCAB_ANNOTATIONS ()

A sample code for DEFINE_VOCAB_ANNOTATIONS ()method is provided below for reference:

method DEFINE_VOCAB_ANNOTATIONS.
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


  lo_reference = vocab_anno_model->create_vocabulary_reference( iv_vocab_id = 'ZV4COMM_BRR'
                                                                iv_vocab_version = '0001').
  lo_reference->create_include( iv_namespace = 'com.sap.vocabularies.Communication.v4' ).
  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_ann_target = vocab_anno_model->create_annotations_target( 'Soheaderdata' ).