
The Base Class CL__Project Name_MPC that gets generated will have redefinition for DEFINE() and GET_LAST_MODIFIED() methods.
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.
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.
For each of the method call there will be a corresponding method implementation in the same class with appropriate details.
The 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.
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.
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.
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.
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.
|
Method Name |
GET_EXTENDED_MODEL |
|
|
Visibility |
Public |
|
|
Final |
X |
|
|
Parameter Name |
EV_EXTENDED_SERVICE |
Exporting |
|
EV_EXT_SERVICE_VERSION |
Exporting |
|
|
EV_EXTENDED_MODEL |
Exporting |
|
|
EV_EXT_MODEL_VERSION |
Exporting |