SAP BTP: Handling the Business Logic in RAP – Part 1

SAP BTP business logic implementation using RAP framework.

RAP offers enhanced ways of carrying out the business rationale. Every technique has its own importance and individual place of execution. Business Logic in RAP.

RAP gives four primary areas of interest where execution of business rationale is thought of. They are:
Activity
Capability
Assurance and
Approvals.
Absence of appropriate comprehension might bring about bumbling of the execution.

Below is the concise explanation and importance of each of these key-words with the exact signature. Business Logic in RAP.

1. Actions: To execute business rationale in a way of behaving of a Compact discs Element, an activity is characterized.

    • It is a write access.  
    • It is declared with keyword action in the behavior definition.
    • An action can be instance or static.
    • An action has exactly one input parameter.
    • Input parameter can be a structured data type or a CDS Entity.
    • Exactly one output parameter can be defined for actions.
    • The return parameter can be defined by result keyword followed by the cardinality and data type.
    • The return parameter can be the CDS entity or dictionary data type.
    • If the return parameter is the same CDS entity, it is defined with keyword $self.
    • Entity keyword is used to specify non-abstract CDS entity with behavior definition.

Example:

2. Functions: A Capability is a procedure on a CDS substance which permits playing out certain computations.

    • It is a read access.
    • It does not require locking of the CDS Entity.
    • It is defined with the keyword function in the behavior definition.
    • It has to have a return parameter.
    • It can be static or instance based.
    • Selective keyword is used to return only selected field of the return parameter.

Rapid Prototyping

Example:

3. Determinations: Conclusions is utilized for dealing with inside business rationale.

    • Determinations are implemented based on a trigger condition also known as triggers.
    • A trigger condition can be triggered by standard operation like create, update and delete.
    • A trigger condition can also be triggered by change of field values in an instance of a CDS entity.
    • The fields can be single or multiple ( if one or both the fields change ).
    • The combination of field sequence and standard operations can also be a trigger condition.
    • They are available in managed scenarios and unmanaged with only draft handling.
    • Determinations are applied via on_modify or on_save operations.
    • Keyword is determination followed by the name of the determination.

Example with CUD Operations:

Example with field changes:

4. Validations: Validations are like conventional approval checks we have been involving in the programming.

    • An validation is executed in the save succession.
    • Coming up short of an approval can prompt the early termination of a save grouping.
    • It very well may be set off with similar trigger circumstances as in judgments.
    • These are taken care of by the RAP structure in the CHECK_BEFORE_SAVE grouping.
    • It is characterized by the catchphrase approval followed by the name and trigger.

Example:

Example with field changes:

Example with mixed triggers:

In this way, if any questioner or as a backend designer, beneath are the responses to the application questions :

  • Need to compute on read of the element – Capability

YOU MAY BE INTERESTED

SAP ABAP HANA: Revolutionizing Enterprise Application

Best Practices for SAP ABAP Development: A Comprehensive Guide

Using ABAP Classes in Workflow