Show TOC

Base Class: Model Provider ClassLocate this document in the navigation structure

Use

The Base Class CL__Project Name_MPC that gets generated will have redefinition for DEFINE() and GET_LAST_MODIFIED() methods.

DEFINE () Method

The content of the Define () method depends on the OData artifacts which are created for a model in SEGW (such as, entity types, associations, function imports, complex types, and more). For each of the artifacts created, one method will be generated and called inside this Define () method.

Sample Code

A sample code for the Define () method for the sample model is provided below for reference:

method DEFINE.
*&---------------------------------------------------------------------*
*&           Generated code for the MODEL PROVIDER BASE CLASS          &*
*&                                                                     &*
*&  !!!NEVER MODIFY THIS CLASS. IN CASE YOU WANT TO CHANGE THE MODEL   &*
*&        DO THIS IN THE MODEL PROVIDER SUBCLASS!!!                    &*
*&                                                                     &*
*&---------------------------------------------------------------------* 
define_entity_type_1( ).
define_entity_type_2( ).
define_associations( ).
Define_complextypes().
Define_actions(). 

endmethod.
 
Note
  1. For each of the method call there will be a corresponding method implementation in the same class with appropriate details.

  2. The SAP Gateway Service Builder allows to define an entity type of length 40 characters whereas the ABAP method name of a class should be restricted to 30 characters. In cases where two entity names have similar first 31 characters and last few characters unique, the class will still be generated with unique method names.

  3. In the define method of the class super->define() will be called only if at least one entity type (corresponding entity set) is set as subscribable.

  4. All the entity types will have their corresponding TYPES definition & names as constants and available in the class, which can be used in the code.

Define GET_LAST_MODIFIED Method

A sample code for Get_Last_Modified method is provided below for reference:

method GET_LAST_MODIFIED.
*&---------------------------------------------------------------------*
*&           Generated code for the MODEL PROVIDER BASE CLASS          &*
*&                                                                     &*
*&  !!!NEVER MODIFY THIS CLASS. IN CASE YOU WANT TO CHANGE THE MODEL   &*
*&        DO THIS IN THE MODEL PROVIDER SUBCLASS!!!                    &*
*&                                                                     &*
*&---------------------------------------------------------------------*


  CONSTANTS: lc_gen_date_time TYPE timestamp VALUE '20121031052115'.
  rv_last_modified = super->get_last_modified( ).
  IF rv_last_modified LT lc_gen_date_time.
    rv_last_modified = lc_gen_date_time.
  ENDIF.
endmethod. 
Note

The latest timestamp at which the class was last modified will be returned by this method.

Additional Information

The information provided in this section is only for reference.

Method: LOAD_TEXT_ELEMENTS : This method is set as final in the MPC class and is required for internal label handling. Hence this method need not be modified/redefined by the user in the extended class.

Method Name

LOAD_TEXT_ELEMENTS

Visibility

Public

Final

X

Parameter Name

RT_TEXT_ELEMENTS

Method: GET_EXTENDED_MODEL : This method will be present in the MPC class only during a redefine scenario. This method is set as final in the MPC class and it is required for internal handling of overwrite scenario. Hence this method need not be modified/redefined by the user in the extended class.