Analyzing a Business Object

After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Analyze a Business Object

Analyzing an RAP Business Object

In the ABAP RESTful Application Programming model (RAP), a business object defines a particular entity, such as a travel agency. Its definition has two parts; a CDS view, which defines the structure of the object or, in other words, the fields that it contains, and a behavior definition, which describes what you can do with the business object.

The behavior definition specifies which of the standard operations, create, update, delete are allowed. It can also contain the definition of validations, determinations, and actions. Validations check that the data is correct when you create or update a record. Determinations modify instances of business objects based on trigger conditions. Actions are non-standard operations which you use to provide customized, business-logic-specific behavior. Approving a purchase order or canceling a flight are activities that you would implement as an action.

The behavior implementation consists of one or more ABAP classes. Here the validations, determinations, and actions are implemented. When it comes to the standard operations, RAP distinguishes two implementation scenarios: In the unmanaged implementation scenario, create, update, and delete are implemented in the behavior implementation. In the managed implementation scenario the RAP runtime takes care of them.

RAP business objects are commonly used in generated Fiori Elements apps or Web APIs. However, you can also access them from ABAP coding using Entity Manipulation Language (EML). This is a set of ABAP statements that allows you to create, read, update, and delete data using business objects. When you create business objects using RAP, you will have to implement its application-specific behavior. You use EML in this context to access the application data.

In this unit, you will create a class that modifies travel agency data. The view entity contains the key field AgencyID and various other fields containing information about the travel agency.

Behavior Definition and Implementation

A validation is a check that the RAP runtime performs when data is changed. Here, the validation is always performed when a new record is created (trigger create;) If an existing record is changed, the validation is only performed if the Name field has been changed (trigger field Name;).

Validations are defined in the behavior definition. For each validation, there is a corresponding method in the behavior implementation.

How To Analyze A Business Object

Log in to track your progress & complete quizzes