Show TOC

Generating the ServiceLocate this document in the navigation structure

Use

This section guides you to generate the Model Provider Classes Data Provider Class in the Service Builder:

Procedure

You can generate the service after importing the properly defined data model into the Service Builder project you have created.

In addition, you should regenerate the service whenever you modify the properties of the data model.

To generate Model Provider Class and Data Provider Class proceed as follows:

  1. Open the SAP NetWeaver Gateway Service Builder using the transaction SEGW.

    There are two scenarios you could encounter:

    1. You have to create a new project.

      In this case, first create a project. Follow the instructions given in section Creating a Project and

      Using File Importer and then follow the steps provided in this section to generate the MPC class.

    2. A project might already exits.

      In this case proceed as follows:

  2. Click the icon, Edit, Display-->Change to switch to edit mode.

  3. Right click the project folder and choose Generate Runtime

    Figure 1: Project->Generate Runtime selected

    Alternatively, you can also select the project and click the icon, Generate,Generate Runtime Objects in the menu bar.

    On following any of the above steps, the Model and Service Definition dialog box displays.

    Figure 2: Model and Service Definition Dialog box
    Note

    Incase if you do not want to generate the DPC, you have an option to deselect the Generate Classes check box. By doing so, this dialog displays during regenerations till the DPC is generated. But the Model Provider Class names can be specified only once during generation.

    Figure 3: Model and Service Definition Dialog box with Generate Classes deselected

    The Service Builder automatically populates the names values for the fields in the Model and Service Definition dialog box. Optionally you can also change the proposed names for the classes to be created.

  4. To change the proposed names, do the following in the Start of the navigation path Model and Service Definition Next navigation step Model Provider Class region End of the navigation path.

    Fields

    Proposed Naming Convention

    Class Name - Implementation Class

    CL_<Project Name>_MPC_EXT

    Project Name is the actual name of project in the Service Builder.

    Base Class Name

    CL_<Project Name>_MPC

    Project Name is the actual name of project in the Service Builder.

    Class Name - Implementation Class

    CL_<PROJECT NAME>_DPC_EXT

    Base Class Name

    CL_<PROJECT NAME>_DPC_EXT

    Technical Model Name

    <PROJECT NAME>_MDL. For example, SALESORDER_MDL

    Technical Service Name

    <PROJECT NAME>_SRV. For example, SALESORDER_SRV

  5. Click the icon, Continue, Continue to start the generation.

    The Transport Request dialog opens.

  6. Choose Local, or assign the objects to the appropriate package.

    The Service Builder creates the classes, lists them in the Generated Objects folder of the project and registers the service.

Result

On successful generation, the generated objects are stored under the Generated Objects folder in the tree view. Also the message displaying the results of the generation are displayed in the mass edit view.

Figure 4: Generated Objects and Messages

You have generated code for the MPC and DPC classes.

In addition, you have registered the service for use in Gateway.

More Information

Next steps requires that you implement your own code to redefine the implementation classes for the MPC and he DPC.

To proceed to the next steps, see Redefining the MPC Implementation Class, and then Redefining the DPC Implementation Class.