Mentor SAP
Define and Implement the Behavior (Transactional apps only).
The behavior of a RAP BO is defined in a repository object called CDS Behavior Definition. Usually, the behavior of a RAP BO also requires some additional logic which is implemented in a certain type of global ABAP class, called a Behavior Pool. For a non-transactional application, for example, a list report, the behavior definition or implementation can be omitted.

 

  • Project the RAP Business Object and provide service specific Metadata.
    The projection of the RAP BO consists of a data model projection, and, if a behavior has been defined, a behavior projection. To define a projection, you create one or more CDS projection views, a type of CDS View, and a Behavior Projection, a type of behavior definition. For UI services, the projection view(s) should be enriched with UI specific metadata. To support future extensibility of the application, we recommend placing the service specific annotations in metadata extensions.

     

  • Define the Service.
    In RAP, a service is defined by creating a Service Definition. The service definition references the projection views and specifies which of them should be exposed, that is, which of them are visible for the service consumer.

     

  • Bind the Service and Test the Service.
    To specify how the service should be consumed ( UI or Web API) and via which protocol (OData V2 or OData V4), a service binding is needed. For UI services, a Preview is available

     

  • Repository Objects for RAP

     

    When expanding the content of an ABAP Development Package in the Project Explorer of ADT, the repository objects are found in different categories of repository objects.

     

    The database tables, along with the include structures, data elements, and domains needed for their definition, are found in category Dictionary.

     

    The repository objects defining the data model and projection views, are found in the Core Data Services → Data Definitions node. According to the recommended naming pattern, the data model views should have a letter "I" (for Interface) and the projection views a letter "C" (for Consumption).

     

    The repository objects for the definition and projection of the RAP BO behavior are located in Core Data Services → Behavior Definitions. Again, the letters "I" and "C" should help to distinguish between repository objects for definition and for projection.

     

    Service Definitions and Service Bindings have their dedicated sub-nodes under the Business Services category.

     

    The Behavior Implementation is done in behavior pools, which are global ABAP classes that fulfill certain requirements. Like all global ABAP classes, they can be found in Source Code Library → Classes. To make behavior pools distinguishable from other ABAP classes, the naming pattern requests their names to start with "BP_" or "BP_" instead of the usual "CL_" or "CL_" for ordinary ABAP classes.

     

    Similarly, a certain group of global classes used to represent messages at runtime should have names starting with "CM_" or "CM_".