Ansicht
Dokumentation

ABENBDL_VALIDATION_ABEXA - BDL VALIDATION ABEXA

ABENBDL_VALIDATION_ABEXA - BDL VALIDATION ABEXA

Addresses (Business Address Services)   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- Validation

This example demonstrates how a validation is defined, implemented, and consumed in a managed RAP BO.

Data model

The CDS data model consists of the root view entity DEMO_SALES_CDS_SO_1, which represents a sales order.



Behavior definition

The CDS behavior definition DEMO_SALES_CDS_SO_1 is defined in CDS BDL as follows:

Definition of validation

The validation ValidateBuyerId checks if the value entered in field BuyerId is valid by checking whether this buyer ID exists in the database table DEMO_SALES_BUPA, which lists all business partners. It is triggered as soon as the field BuyerId is changed. If the buyer ID is not valid, the data changes are rejected and an error message is returned.

validation ValidateBuyerId on save { field BuyerId; }

Behavior implementation

For the above CDS behavior definition, one ABAP behavior pool (ABP) is created. The global class of the behavior pool is BP_DEMO_SALES_CDS_SO_1. The actual implementation takes place in the BP_DEMO_SALES_CDS_SO_1========CCIMP.

Source Code

Execute

Description

Access with ABAP using EML

The above source code uses EML to access the RAP business object from an ABAP program:

  • A BO entity instance with the buyer ID a is created. This is a valid buyer ID, so the instance is committed to the database.
  • Two further BO entity instances are created with invalid buyer IDs. These entity instances are rejected by the validation and they are inserted into an error table instead.
  • The valid and the invalid entity instances are created in separate RAP LUWs. If all three entity instances were created in one RAP LUW, all three of them would be rejected. All data changes in one RAP LUW must be consistent, otherwise, the complete content of the transactional buffer is rejected.





Fill RESBD Structure from EBP Component Structure   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 3241 Date: 20240424 Time: 113001     sap01-206 ( 74 ms )