Show TOC

Generating ABAP ClassesLocate this document in the navigation structure

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:
  1. In the SAP Gateway Service Builder, right click the project name and click Generate Runtime. Alternatively, select the project, and click Generate Runtime Objects (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.
  2. Enter a name for the implementation class in the Class Name field. Naming convention: CL_<PROJECT NAME>_MPC_EXT.
  3. Enter the name for the base class in the Base Class Name field. Naming convention: CL_<PROJECT NAME>_MPC
    Note
    • The MPC names cannot be changed after they have been generated.
    • Class and Base Class name are mandatory.
  4. 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.
  5. 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.
  6. 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.
    Note
    • Make a note of the Technical Service Name. You use this name to register and to activate the specific service in the SAP Gateway system. See Activate the Service to register and activate the service in the SAP Gateway system.
    • If you have redefined an existing service, an additional section Service Extension appears in this wizard. Select Overwrite Base/Extended Service, to overwrite the contents of the referenced service class. This option allows you to access the redefined (new) service using the redefining (base) service URL. You can no longer access the redefining service using the same URL. The BEP registry stores the values of Technical Service Name and Service Version while generating the runtime objects.
    You can edit the Technical Model Name. The Technical Service Name cannot be edited. An error displays if you do not specify the technical names.
  7. Click Continue. The Transport Request dialog opens.
  8. 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.
The Service Builder saves the content of the project, checks the project, and saves it again. It then creates the classes, lists them in the Generated Objects folder of the project, and registers the service in the backend system. Double-click any of the content in the Runtime Artifacts folder, on the right. In the Runtime Artifacts screen, you can view the properties of the classes.

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.