Preface – This post is part of the SAP ABAP RAP series.
Table of Contents
In the previous lesson, we discussed creating CDS views. Now, the next artifact to create after CDS View is Behavior Definition. But first, we will understand what is a general understanding of behavior definition from a simple visual.
Carefully observe the dog clips.
We can clearly see the actions performed by a dog by just observing the clipart. These actions can also be termed as the behavior of a dog which it performs as per the situation. Similarly, for our business objects, we need to decide and define how the CDS view should behave according to requirements.
A behavior definition is an ABAP repository that represents the behavior of business objects in the context of SAP ABAP RAP.
- The root entity can have at most one Behavior definition defined to it.
- The behavior definition specifies the child entities of the root.
- The implementation of behavior definition is performed in Behavior Implementation Class.
How to create a Behavior Definition?
To create the behavior definition, follow the below steps:
- Right-click on Interface view and select New Behavior Definition.
- Provide Description, Package details and Implementation type. The most important part while creating the behavior definition is a selection of the Implementation type. This implementation type will define the scenarios you are working on: Managed or Unmanaged Scenario.
Here, we have selected the Managed Scenario.
- Select Transport Request.
- And now our behavior definition is created.
Here we have defined the simple operations CREATE, UPDATE, DELETE. We would be making use of these operations in our application.
As we are working on Managed scenario here, we don’t have to write explicit EML’s (Entity Manipulation Language) to perform these operations. This will be handled by the system. But when an Unmanaged scenario comes into the picture, we need to explicitly handle the business logic in Behavior Implementation.
We will dig deep into it in later articles.
- Save and activate.