Skip to Content
0
May 09, 2020 at 04:26 PM

OData Enum Types in ABAP

93 Views

oData V4 support enumeration types. I need advice on how to define enum type in a model define class for odata v4 model in classic ABAP programming? Thank you.

Example of metadata with enum type:

edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="com.sap.icd.odata4.example">
<EnumType Name="XXXX" IsFlags="false" UnderlyingType="Edm.Int32">
<Member Name="WEEKLY" Value="0"/>
<Member Name="BIWEEKLY" Value="1"/>
<Member Name="SEMI_MONTHLY" Value="2"/>
<Member Name="MONTHLY" Value="3"/>
</EnumType>
<EntityType Name="Create">
<Key>
<PropertyRef Name="id"/>
</Key>
<Property Name="id" Type="Edm.String"/>
<Property Name="Country" Type="Edm.String"/>
<Property Name="Town" Type="com.sap.icd.odata4.example.XXXX"/>
<Property Name="startDay" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
</EntityType>
<EntityContainer Name="container">
<EntitySet Name="ViewSet" EntityType="com.sap.icd.odata4.example.View"/>
<EntitySet Name="EventSet" EntityType="com.sap.icd.odata4.example.AreaEvent"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>