Extending the Interface of an OData Entity Using Custom Fields
The OData service model delivered in SAP Multichannel Foundation for Utilities is built via the Gateway Service Builder (SEGW) tool. Depending on the business needs, the Gateway service model can be extended on different levels:
- OData entity structure extension (adding append structure with custom fields)
- Addition of new OData entities
- OData entity logic extension (for example, adding additional validations)
In this blog, we will illustrate how to add a custom field to an existing entity. Extension on other levels ( new OData entities, etc.) will be covered in another blog post.
The common situation a customer faces is that the field a customer requires is not in our standard structure of an OData entity.
Customer requirement: The OData entity should include Nationality information.
- Start SEGW in the SAP CRM system and create a new service model project ZCRM_UTILITIES_UMC.
- Right click on Data Model, select Redefine OData service (GW).
- Select CRM_UTILITIES_UMC as a service to be redefined.
- Select all entities to be included in the new service.
- Please check the API structure and make sure if it exists in the backend interface.
- In SE80, add append structure to CRMS_IU_UMC_ACCOUNT.
- Add field Nationality.
- Since we always do move-corresponding in our implementation behind each entity, newly added field should become visible in the entity after adding to the service model.
10.Choose Generate model.
11.The newly added field should become visible in the service metadata.