At runtime SAP Gateway classes (model provider class and data provider class) consider the fields in the extension includes in ABAP Dictionary structures. That means that entity sets that are technically based on ABAP Dictionary structures for which SAP provides the option to extend them via append structures will automatically show new properties if the underlying ABAP Dictionary structure has been enhanced by the customer. This process is called Simple Field Extensibility (SFE). Properties that have been created by using SFE contain the annotation sap:is-extension-field="true".
Sample coding: In this example the type and maxlength of property AMOUNT11 within entity type Auto_Expand is changed.
METHOD /iwbep/if_mgw_bd_modify_model~modify_auto_expand_properties. DATA: ls_property LIKE LINE OF it_properties, lo_property TYPE REF TO /iwbep/if_mgw_odata_property. IF iv_include_name EQ '/IWBEP/S_TEA_AUTO_EXPAND_I1' AND iv_entity_type_name EQ 'Auto_Expand'. LOOP AT it_properties INTO ls_property. IF ls_property-internal_name = 'AMOUNT11'. ls_property-property->set_type_edm_string( ). ls_property-property->set_maxlength( 10 ). ENDIF. ENDLOOP. ENDIF. ENDMETHOD
You can verify the correct behavior as follows: In the HTTP output, first search for the correct entity type: Auto_Expand. When this has been found, scroll down until you find the property modified by the BADI: 'AMOUNT11. Verify that the property has the modifications caused by the BADI as shown below.
<Property Name="AMOUNT11" Type="Edm.String" MaxLength="10" sap:unit="CURRENCY11" sap:is-extension-field="true"/>