SEGW Project: Entity Type, Entity Set and Service Runtime
Learn the basic SEGW building blocks used to expose SAP data as OData.
Explanation
In SEGW, an Entity Type represents the structure of one business object, such as Customer, Sales Order or Invoice. An Entity Set represents a collection of that entity. Properties are fields inside the entity, and key properties uniquely identify one record. After generating runtime artifacts, Gateway creates model provider and data provider classes. MPC_EXT is used to influence metadata, while DPC_EXT is used to implement data retrieval and business operations. Beginners must clearly understand that SEGW modeling and DPC_EXT implementation work together: the model defines what the service exposes, and DPC_EXT defines how data is fetched or changed.
Code example
* SEGW concept mapping:* Entity Type -> Customer* Entity Set -> CustomerSet* Key Property -> CustomerId* Properties -> CustomerId, Name, City, AccountGroup * Runtime classes:* MPC_EXT -> metadata/model extension* DPC_EXT -> data provider implementation * In DPC_EXT, implement generated methods such as:* CUSTOMERSET_GET_ENTITYSET -> list of customers* CUSTOMERSET_GET_ENTITY -> single customer by keyReal project scenario
A CustomerSet entity set exposes customer number, name, city and account group from KNA1. CUSTOMER_ID is marked as key and implemented in CUSTOMERSET_GET_ENTITYSET and CUSTOMERSET_GET_ENTITY.
Common mistakes
- Not marking key fields correctly. - Confusing entity type and entity set. - Changing generated base class instead of EXT class. - Regenerating project and losing custom code in wrong place.
Best practices
- Always code in EXT classes. - Define correct key fields. - Keep model simple and business-oriented. - Use meaningful entity and property names.
Interview angle
Interviewers expect clarity on entity type, entity set, key property, MPC_EXT and DPC_EXT.