Extend OData Model with New Entity Properties
There are a few options available for appending new properties to an OData entity in a customer system.
One option is to create a new project in the Gateway Service Builder and to redefine the data model of the OData service that you want to extend. You can append new properties to a corresponding entity type in the data model redefinition.
Another option is to extend the MPC_EXT class by redefining the method DEFINE and adding new properties to the entity type. The method can look like this example:
METHOD define.
super->define( ).
DATA(lo_entity_type) = model->get_entity_type( 'Product' ).
DATA(lo_property) = lo_entity_type->create_property(
iv_property_name = 'HazardWarning'
iv_abap_fieldname = 'HAZARD_WARNING').
lo_property->set_type_edm_decimal( ).
lo_property->set_precison( iv_precision = 3 ).
lo_property->set_maxlength( iv_max_length = 18 ).
lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
ENDMETHOD.