ABAP for Cloud Development
AS ABAP Release 914, ©Copyright 2024 SAP SE. All rights reserved.
ABAP - Keyword Documentation → ABAP RAP Business Objects → ABAP for RAP Business Objects → ABAP for Providing RAP Business Objects → ABAP Behavior Pools (ABP) → RAP Handler Classes and Methods → METHODS, FOR, RAP Handler Methods →
FOR VALIDATE, RAP Handler Method
Syntax
Handler method definitions:
METHODS meth FINAL
FOR VALIDATE ON SAVE
IMPORTING
REFERENCE
(im_par_val) im_par_val
FOR bdef~val
CHANGING
failed
TYPEdata
reported
TYPEdata
.
Description
Handler method that is used for the validations. It must be defined and implemented in a handler class of an ABAP behavior pool.
The method name meth
can be chosen freely. bdef
is the name or the alias of the BDEF and val
is the name of the validation.
Method Parameters
IMPORTING
parameters:im_par_val
: Includes the keys of RAP BO instances that are to be validated. It is an internal table of typeTYPE TABLE FOR VALIDATION bdef~val
.- The importing parameter can also be passed by reference (see
REFERENCE
). The use of the ABAP wordIMPORTING
is optional. CHANGING
parameters:- The
CHANGING
parametersfailed
andreported
(RAP response parameters) are implicitly available. It is possible to specify the parameters with the predefined namesfailed
andreported
explicitly following the ABAP wordCHANGING
. The generic typeDATA
can be specified. At runtime, the typed parameters implicitly have the BDEF derived typeTYPE RESPONSE FOR
. Instead ofDATA
, a data type of typeTYPE RESPONSE FOR
can be specified.
BDEF Requirements
See the required BDEF notations for both variants in the topic RAP - validation
.
Example
Example for a RAP handler method definition. Find demonstrations of method implementations in the executable examples further down.
...
METHODS det_on_save FOR VALIDATE ON SAVE
IMPORTING keys FOR bdef~val.
...
Executable Examples
- Example for RAP Handler Methods: Demonstrates this RAP handler method within a RAP handler class using a simple unmanaged RAP BO that is draft-enabled.
- RAP BDL - validation