Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

Now that annotations are making UI5 development easier by using Smart controls, it is important to learn how to add these annotations to your service. SEGW does not yet allow you to add most of the annotations. Till SEGW inherently provides that feature, here is how you can do it using code.

Step 1. Goto you MPC_EXT class
Step 2. Redefine Define method.
Step 3. Write this code.
  METHOD define.

DATA: lo_entity_type TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
lo_property TYPE REF TO /iwbep/cl_mgw_odata_property,
lo_annotation TYPE REF TO /iwbep/if_mgw_odata_annotation.

super->define( ). "Ensure you call the parent metadata

lo_entity_type = model->get_entity_type( iv_entity_name = 'SESItem'). "Your Entity Name

lo_property ?= lo_entity_type->get_property( iv_property_name = 'Date'). "Property inside your Entity

CALL METHOD lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation
iv_annotation_namespace = /iwbep/if_mgw_med_odata_types=>gc_sap_namespace
ro_annotation = lo_annotation.

lo_annotation->add( iv_key = 'display-format' iv_value = 'Date' ). "Specific annotation you want to add.


This will result in

Labels in this area