Skip to Content

Prepare the RAP-Based Travel Service

Prepare a travel service based on the SAP ABAP RESTful Application Programming Model (RAP).
You will learn
  • How to generate a RAP service as a preparation for this tutorial
  • How to publish and test the RAP service using the preview option of the ABAP Development Tools
jo-fiessJoachim FiessJune 22, 2021
Created by
jo-fiess
June 22, 2021
Contributors
jo-fiess

Prerequisites

This tutorial shows how to create an individual RAP-based OData service, which can be used within all the steps of the upcoming chapters of the tutorials presented within the tutorial group.

For more information about the ABAP RESTful Application Programming Model (RAP), especially related to the different CDS view files used in the upcoming chapters, please refer to the documentation pages of Get to Know the ABAP RESTful Application Programming Model.

  • Step 1

    This tutorial requires an individual OData service having a unique suffix for each participant. This is necessary due to the fact that, within a specific ABAP cloud back-end system, all the development objects (e.g. packages, data-elements, classes, etc.) are globally available for all trial users who are connected to the same system. Since the creation of such an OData service is not the main part of these tutorials, a service generator is used to quickly create an individual service.

    Whenever your unique suffix for creating objects is needed, the object names within this tutorial are named with suffix “######”. For the screenshots taken from a real service, the suffix “000100” was used.

    1. Load the ABAP generator class

      Be sure to have opened the ABAP perspective within the ABAP Development Tools. In case you don´t see the ABAP perspective icon at the top right of the application (see screenshot below), open the ABAP perspective by Window > Perspective > Open Perspective > Other… and choose the ABAP entry within the list of perspectives. Click Open to confirm the dialog.

      Load generator class

      Now choose the toolbar action Open ABAP Development Object to open the ABAP class that is needed to generate the service.

      Load generator class

      The name of the class is /DMO/CL_FE_TRAVEL_GENERATOR. Select the class and confirm the dialog by choosing OK.

      Load generator class
    2. Start the generator class

      As soon as the class is loaded within the editor, open the context menu via right mouse click and start the service by choosing Run As > ABAP Application (Console).

      Load generator class

      The generation of the service may take some time. After the process has finished you will see a console message similar to the message shown in the screenshot below.

      Load generator class
    3. Assign the new package to your favorite packages

      To keep a better overview of your packages, add them by right clicking on the Favorite Packages container and choosing the Add Package… option.

      Load generator class

      Enter the name of your package ZFE_TRAVEL_###### shown in the console message in the dialog and confirm by choosing OK.

      Load generator class

      Now you see the package assigned to your favorite packages.

      Load generator class
    Log in to complete tutorial
  • Step 2
    1. Publish the service

      You must publish the service to be able to use it within your applications. To do so, open the service binding file ZUI_FE_TRAVEL_######_O4 in the Business Services > Service Bindings folder and choose Publish. You will see a progress bar while the process is running.

      Load generator class
    2. Start the service preview

      When the service is published, its entities are shown within a tree view under Service Version Details.

      You can now use the service to create SAP Fiori elements applications.

      To immediately see the service running in an application you can start the preview mode within the ABAP Development Tools. Simply select the main entity Travel in the tree view and choose Preview… on the right.

      Load generator class
    3. Logon to the service preview

      A separate browser window opens and you need to logon with your cloud trial account. Choose Log On after you have entered your credentials.

      Load generator class

      After logging on, a generated list report object page application is shown in preview mode. Since there are no line item annotations available, no columns are shown in the list report table.

      Load generator class

      Adding annotations to enrich the service will be the main part of this tutorial - this will now be done within the upcoming steps in the next chapters.

    Why does the generated service and all its related objects need a unique suffix?

    Log in to complete tutorial
Back to top