The Service Builder enables you to redefine the methods generated for the extension class of the DPC. For each entity set under the Service Implementation folder you can find the methods for the operations. There is one method for each of the following operations; create, read, update, delete (CRUD), and query. You can select the method related to the operation of an entity set to view its implementation or to redefine it.
You can redefine a method using one of the following:
Add your code to the existing code, remove asterisks from the existing code, save and activate the class.
Remove existing code, add your own code, then save and activate your class.
To redefine the method for an operation:
Expand the Service Implementation folder to display its entity sets.
Expand an entity set to display the methods for the operations. Change to edit mode to able to edit the code you want. Right click a method and click Go to ABAP Workbench.
If the selected method has already been redefined, it is presented in the display mode in the transaction SE24.
If the method has not been redefined, a message displays and a list of methods is presented in the display mode in the transaction SE24.
Save the project.
Changes you make in the data model, such as, renaming, removing of entity sets and attributes of entity types, which have been referenced in your code, can result in syntax errors in your implementation.
If no implementation exists for the selected method in the extension class for the Data Provider Class, the Service Builder opens the standard Class Builder screen (transaction SE24).
If the selected method has already been defined, the Service Builder opens the specific method in the extension class of the Data Provider Class.
Redefining a Method
Map request input fields to the data source input fields. This provides information for filters, keys, constants and many more.
Call to the SAP system (backend)
Find only the mapped properties.
There are two sections IF and ELSE. The IF section relates to local RFC destination, the ELSE relates to Remote.
Map data in the SAP system (backend) to the model properties.
You map the response from the data source to the model’s properties in order to return the information to the requesting client. This includes writing to the application log, and handling $skip. For the create operation, there is a read-after-create call. For create, update, delete operations, there is call for saving.
There is one method per operation.
In the declarative part, find the entity type on which the entity set is based. If you change the name of the entity type, it is also reflected in this section.
For every entity set in the project, there is an entry in this section, that passes the relevant information received in the client request to the specific implementing method.
Ref to Data
After executing the entity set specific method, call the method, copy_data_to_ref in order to map the strongly typed results (user_get_entityset) to the runtime data object (er_entityset).