Generating ABAP Classes
Activities
You can automatically generate code for the runtime functionality of your data model. The Service Builder generates the classes with the generated code and handles the service registration process for IW_BEP based services for you. The generated classes are listed in the Runtime Artifacts folder.
To create the classes and register the service, proceed as follows:
- In the SAP Gateway Service Builder, right click the project name and click Generate Runtime. Alternatively, select the project, and click (Generate Runtime Objects), or from Project in the menu, click Generate. The Model and Service Definition window displays. All the fields in this window are editable.
- Enter a name for the implementation class in the Class Name field. Naming convention: CL_<PROJECT NAME>_MPC_EXT.
- Enter the name for the base class in the Base Class Name field. Naming convention: CL_<PROJECT NAME>_MPC
- In Data Provider Class section, Generate Classes is selected by default to generate the classes for the Data Provider Class (DPC). If you do not want to generate DPC, deselect Generate Classes.
- In Backend Operation Proxy (BOP) Prefix, specify a prefix. The specified prefix is used as part of the BOP interface name. The default prefix is ZIF_. By default, the BOP prefix name is: < namespace of the project> and the <IF_>. When you generate the project, Service Builder checks if the BOP prefix is aligned with the chosen package (derived from the transport request). If not aligned, the appropriate error message displays. In addition, Service Builder creates the BOP interface name for each function module that has been mapped in the specific project. The BOP interface name is created as follows: < BOP prefix> and the function module name. The generated BOP interface is available in the Runtime Artifacts folder under the project and it is listed as Backend Operation Proxy.
- Under Service Registration, do the following:
- Technical Model Name: Specify the Technical Model Name. This references the Model Provider Class which provides the metadata for the model.
- Model Version: Specify the version number for the model.
- Technical Service Name: Specify the Technical Service Name. This is a key to assign the models to a Service.
- Service Version: Specify the version number for the service.
- Click Continue. The Transport Request dialog opens.
- Choose Local, or assign the objects to the appropriate package. You can assign the generated classes to a transport request. The Service Builder checks if the MPC classes are already assigned to a transport request package, and if they are, the DPC classes are automatically assigned to that same transport request.
Service Builder refers SEGW tables to fetch the generated class names. It does not verify whether the classes were later modified. Hence during regeneration, the generated MPC and DPC base classes are always overwritten. If you delete a class and create another class with similar name for some other project, on regeneration these classes are overwritten.