Show TOC

Implementing Metadata Provider ClassLocate this document in the navigation structure

  1. Log on to the SAP Gateway System on which the software component IW_BEP is deployed.

  2. Go to transaction SE24.

  3. Create a new ABAP OO Metadata Provider Class.

  4. Derive your class from super class /IWBEP/CL_MGW_ABS_MODEL.

  5. Redefine method GET_LAST_MODIFIED.

    GET TIME STAMP FIELD rv_last_modified. 
    Note

    Time stamp last modification: Last-Modified in the HTTP header is set based on this time stamp. Web Infrastructures can use this header field to carry out caching.

  6. Redefine the method DEFINE of your metadata provider class.

    Sample code

    DATA:
    lo_annotation TYPE REF TO /iwbep/if_mgw_odata_annotation,
    lo_data_object TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
    lo_flight_object TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
    lo_entity_set TYPE REF TO /iwbep/if_mgw_odata_entity_set,
    lo_complex_type TYPE REF TO /iwbep/if_mgw_odata_cmplx_type,
    lo_association TYPE REF TO /iwbep/if_mgw_odata_assoc, 
    lo_property TYPE REF TO /iwbep/if_mgw_odata_property,
    lo_action TYPE REF TO /iwbep/if_mgw_odata_action,
    lo_parameter TYPE REF TO /iwbep/if_mgw_odata_parameter.
    * first creating the flight data object
    lo_flight_object = model->create_entity_type( 'Flight' ).
    * define properties + keys
    lo_property = lo_flight_object->create_property( iv_property_name = 'carrid').
    lo_property->set_is_key( ). 
    lo_property = lo_flight_object->create_property( iv_property_name = 'connid').
    lo_property->set_is_key( ).
    lo_property = lo_flight_object->create_property( iv_property_name = 'fldate').
    lo_property->set_is_key( ).
    lo_flight_object->create_property( iv_property_name = 'PRICE' ).
    lo_flight_object->create_property( iv_property_name = 'CURRENCY' ).
    lo_flight_object->create_property( iv_property_name = 'PLANETYPE' ).
    lo_flight_object->create_property( iv_property_name = 'SEATSMAX' ).
    lo_flight_object->create_property( iv_property_name = 'SEATSOCC' ).
    lo_flight_object->create_property( iv_property_name = 'PAYMENTSUM' ).
    lo_flight_object->create_property( iv_property_name = 'SEATSMAX_B' ).
    lo_flight_object->create_property( iv_property_name = 'SEATSOCC_B' ).
    lo_flight_object->create_property( iv_property_name = 'SEATSMAX_F' ).
    lo_flight_object->create_property( iv_property_name = 'SEATSOCC_F' ).
    lo_flight_object->bind_structure( 'SFLIGHT' ).
    * create an entityset name, by default there is a entityset
    called <entity type> Collection, so the following could be also
    ignored
    lo_entity_set = lo_flight_object->create_entity_set('Flights' ). 
  7. Activate the class.

Continue with Implementing Entity Data Provider

Back to Developing Content on SAP Gateway OData Channel Using IWBEP