Show TOC

Model Provider ClassLocate this document in the navigation structure

This document makes you familiar with the Model Provider Class created on generating a project that complies with OData V4.

Introduction
The Service Builder provides you an option of generating the Model Provider Class(MPC). For Model Provider Class, when you initiate the generation process, you must specify two names in the dialog box under Model Provider Class:
  • Class Name
  • Base Class Name
Table 1: MPC Generation

Fields

Description

Naming Sample

Class Name

This is the Implementation class that inherits Base class. This class can be modified manually.

CL_<Project Name>_MPC_EXT. Project Name is the name of project in Service Builder

Base Class Name

This is the Base class that is generated by system during generation process. It inherits from runtime abstract class /IWBEP/CL_V4_ABS_MODEL_PROV.
Note Do not modify this class.

CL_<Project Name>_MPC. Project Name is the name of project in Service Builder

Note Once classes are generated the MPC names cannot be changed.
After generation, the Service Builder creates two types of Model Provider Classes: Base Class and Extension Class.
Base Class
The Base Class CL__<Project Name>_MPC generated will have DEFINE() method. The content of Define() method depends on the OData artifacts which are created for a model in SEGW (such as entity types, complex types, and more). For each of the artifacts created, one method is generated and is called inside this method.
Sample Code
method /IWBEP/IF_V4_MP_BASIC~DEFINE.
*&----------------------------------------------------------------------------------------------*
*&* This class has been generated on XX.XX.XXXX in client ABC
*&*
*&*       WARNING--> NEVER MODIFY THIS CLASS <--WARNING
*&*   If you want to change the MPC implementation, use the
*&*   generated methods inside MPC subclass - CL_XXX_XXXX_MPC_EXT
*&-----------------------------------------------------------------------------------------------*
  define_XX( io_model ).
  endmethod.
Implementation Class
The Service Builder generates an extension class along with the base class for every model. It is proposed to extend this class manually to suit your needs. After generating the Model Provider Class the generated classes are stored in the Runtime Artifacts folder. Follow the instructions provided below to redefine the methods in an implementation class:
  1. Expand the Project folder in the tree view of the Service Builder.
  2. Navigate to Runtime Artifacts folder and right click on CL_<Project Name>_MPC_EXT
  3. Select Go to ABAP Workbench
  4. Click on the method that you want to redefine.
  5. Click Display <-> Change to change to edit mode.
  6. Make changes as required and click Save to save the changes.