cancel
Showing results for 
Search instead for 
Did you mean: 

Model provider class and data provider class

rahul5791
Explorer

please explain Model provider class and data provider class?

Accepted Solutions (1)

Accepted Solutions (1)

ChandraMahajan
Active Contributor

Hi,

both MPC and DPC get generated as runtime artifacts.

MPC - This is used to define model. you can use the method Define to create entity, properties etc using code based implementation. you rarely use MPC extension class.

DPC - used to code your CRUDQ methods as well as function import methods. you write all your logic in redefined methods of DPC extension class.

Refer Generated ABAP Classes and Service Registration - SAP NetWeaver Gateway - SAP Library for more information.

you can also refer my blog which will provide you clear idea on how to redefine various CRUDQ methods in DPC extension class.

Regards,

Chandra

rahul5791
Explorer
0 Kudos

thanks Chandrashekhar

simonpolovina1
Participant
Former Member
0 Kudos

Hi,

Is it possible to debug the Model Provider Class?

Because when I set a breakpoint in the "define" method from example CL_CRM_LEAD_MPC_EXT, nothing happens when I open the CRM Leads app.

While CL_CRM_LEAD_MPC_EXT is defined as MPC in the OData service.

KR,

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Try to run the url of your service by adding /$metadata in the browser.

Depending on your system settings you might have to delete the cashed metadata for this service.

Best Regards,

Andre

Answers (2)

Answers (2)

Hi,

Model Provider Class

Model Provider class registers the metadata used in a service, it is nothing but base class and model provider extension class is nothing but derived class. MPC is used to define model, you can use the method Define to create entity and properties.

Data Provider Class

Data provider class provides the methods to Data provider Extension class, so developer can implement the functionalities for database interaction. data provider class is base class for data provider extension class.

we will not write any logic inside MPC and DPC classes.

In DPC extension class , we will redefine the methods and implement the logic inside it.

Regards,

Tanuja.

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert

Hi Rahul,

Any Gateway service is implemented by 2 ABAP classes:

  1. Model Provider class
  2. Runtime Data provider class

As Chandra has already shared some points, i suggest you to go through these links also for better understanding:

Rgrds,

JK

rahul5791
Explorer
0 Kudos

thanks jitendra

Former Member
0 Kudos

Hi,

I get the message that the page can not be found when I click on "view document"