Show TOC

Redefining Methods of the OperationsLocate this document in the navigation structure

Procedure
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:
  1. Expand the Service Implementation folder to display its entity sets.
  2. 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 choose Go to Implementation.
    • 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.
  3. Save the project.
Note 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. End of the caution.
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.

Example:

Redefining a Method
  • Declaration part Data declaration
  • Map request input fields to the data source input fields. This provides information for filters, keys, constants and many moreMap request input fields to data source fields
  • 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.Connecting to an SAP system
  • Map data in the SAP system (backend) to the model properties.Mapping response to model propertiesYou 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.
  • Routing mechanism: There is one method per operation.One method for routing per operationIn 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.Declaration per entity type and entity setFor 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).Reference data