Showing results for 
Search instead for 
Did you mean: 

Model provider issue

Former Member
0 Kudos


I've created a custom class that inherits from /IWBEP/CL_MGW_ABS_MODEL.

In the class I have defined types:



begin of HEARTBEAT_S,



TITLE type string,



HEARTBEAT_T type standard table of HEARTBEAT_S.


I've then redfined my DEFINE method:


data: lo_entity_type type ref to /iwbep/if_mgw_odata_entity_typ,

lo_property type ref to /iwbep/if_mgw_odata_property.

  • Setup Heartbeat entity

lo_entity_type = model->create_entity_type( 'Heartbeat' ).

  • Setup properties

lo_property = lo_entity_type->create_property( iv_property_name = 'ServerId'

iv_abap_fieldname = 'SERVERID' ).

lo_property->set_is_key( ).

lo_property = lo_entity_type->create_property( iv_property_name = 'ServerType'

iv_abap_fieldname = 'SERVERTYPE' ).

lo_property = lo_entity_type->create_property( iv_property_name = 'Title'

iv_abap_fieldname = 'TITLE' ).

lo_property->set_as_title( iv_keep_in_content = abap_false ).

  • Bind the structure & create the entity set

lo_entity_type->bind_structure( 'Z_CL_TIM_MODEL_PROVIDER=>HEARTBEAT_S' ).

lo_entity_type->create_entity_set( 'Heartbeats' ).


I've created an empty data provider class that inherits from /IWBEP/CL_MGW_ABS_DATA & then created the technical model that links the model provider class & data provider class & activated the service.

The issue I'm facing is that when I hit the URL to view the xml, the document provided back is missing the collection details:


<?xml version="1.0" encoding="utf-8"?>






<app:workspace sap:semantics="things">



<app:workspace sap:semantics="data">





Any assistance would be greatly appreciated.


Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Tim,

I was able to get the collection details back from your example. (The only thing that I had to change was define /SKY/YECSSRVID and /SKY/YECSSRVTYP locally, just a simple char string).

<?xml version="1.0" encoding="utf-8" ?>

- <app:service xml:base="http://nplhost:8042/sap/opu/sdata/sap/Z_TIM_MODELGRP/" xmlns:app="" xmlns:atom="" xmlns:sap="" xmlns:gp="" xmlns:m="">

- <app:workspace sap:semantics="things">



- <app:workspace sap:semantics="data">


- <app:collection href="Heartbeats" sap:content-version="1">






and the metadata returned was

<?xml version="1.0" encoding="utf-8" ?>

- <edmx:Edmx Version="1.0" xmlns:edmx="" xmlns:gp="" xmlns:m="" xmlns:sap="">

- <edmx:DataServices m:DataServiceVersion="2.0">

- <Schema Namespace="Z_TIM_MODELGRP" xmlns="">

- <EntityType Name="Heartbeat" sap:content-version="1">

- <Key>

<PropertyRef Name="ServerId" />


<Property Name="ServerId" Type="Edm.String" Nullable="false" MaxLength="48" sap:filterable="false" />

<Property Name="ServerType" Type="Edm.String" MaxLength="60" sap:filterable="false" />

<Property Name="Title" Type="Edm.String" sap:filterable="false" m:FC_TargetPath="SyndicationTitle" m:FC_KeepInContent="false" />


- <EntityContainer Name="Z_TIM_MODELGRP" m:IsDefaultEntityContainer="true">

<EntitySet Name="Heartbeats" EntityType="Z_TIM_MODELGRP.Heartbeat" sap:content-version="1" />





How did you define the Ojbect Model and the Service in the IMG?


SAP NetWeaver->SAP NetWeaver Gateway Business Suite Enablement->Backend OData Channel -> Maintain Object Models and Maintain Service

Then activate the services under

SAP NetWeaver->Gateway->Administration->OData Channel->Activate Services

Please let me know if I missed something,

Hope this helps.



Former Member
0 Kudos

Hello Wayne,

I suspect if the issue is due to the types /SKY/YECSSRVID and /SKY/YECSSRVTYP.

I suspect the issue can be due to caching of metadata in Gateway.


If you have redefined the method GET_LAST_MODIFIED in the model provider class, make sure that the method returns the latest timestamp when the model got changed.

Secondly try refreshing the metadata cache for your model in Gateway. The IMG is SAP NetWeaver->Gateway->Administration->Cache Settings->Metadata->Cleanup Cache.

I hope this solves the issue.



Former Member
0 Kudos

Hi Chandan,

Thanks for the info.

I hadn't redefined the GET_LAST_MODIFIED method in my model class.

I checked the metadata cache - strangely my model wasn't listed ???

Regardless, I ticked the clear all checkbox & now when I hit the URL for the service metadata all is displayed.

Thanks for your help.


0 Kudos

I had the same problem and refreshing the cache in SPRO. My Model didn't show up in the list of models either but the "Cleanup Cache for all Models" worked.

However, I've also now redefined the GET_LAST_MODIFIED method and set a breakpoint. But it never seems to be called unless I clean up the cache. And then it doesn't get called until I clean up the cache again. I looked for an OSS Note on this issue but I haven't found one.

Answers (0)