Skip to Content
0
Former Member
Nov 28, 2011 at 04:37 AM

Model provider issue

46 Views

Hi,

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

In the class I have defined types:

*----


types:

begin of HEARTBEAT_S,

SERVERID type /SKY/YECSSRVID,

SERVERTYPE type /SKY/YECSSRVTYP,

TITLE type string,

end of HEARTBEAT_S.

types:

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:service

xml:base="http://nplhost:8042/sap/opu/sdata/sap/HEARTBEAT/"

xmlns:app="http://www.w3.org/2007/app"

xmlns:atom="http://www.w3.org/2005/Atom"

xmlns:sap="http://www.sap.com/Protocols/SAPData">

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

<atom:title>Things</atom:title>

</app:workspace>

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

<atom:title>Data</atom:title>

</app:workspace>

</app:service>

*----


Any assistance would be greatly appreciated.

Tim