SAP RAP MESSAGES ABEXA



Get Example source ABAP code based on a different SAP table
  



RAP Messages: Transition and State Messages
This example demonstrates RAP transition and state messages using a managed, draft-enabled RAP business object.
Data model
The CDS data model consists of the root entity DEMO_DRAFT_M .
Root entity:
DDLS DEMO_DRAFT_M
Behavior definition
The RAP behavior definition DEMO_DRAFT_M is defined in RAP BDL as follows:
BDEF DEMO_DRAFT_M
Behavior implementation
For the above RAP behavior definition, one ABP is created. The global class of the behavior pool is BP_DEMO_DRAFT_M. The actual behavior implementation takes place in local classes that are defined and implemented in the BP_DEMO_DRAFT_M===============CCIMP of the behavior pool. A validation implementation is included. For more information, see the comments in the code.

ABAP_SOURCE_CODE
DEMO CL_DEMO_RAP_MESSAGES_DRAFT_M

ABAP_DESCRIPTION
Access with ABAP using EML
The example demonstrates RAP state and transition messages. For this purpose, the validation implementation in the behavior pool includes the checking of the value of a specific field. A state message is returned if the validations fails. A transition message is returned if the validation is successful. Note that, typically, a validation rather returns a state message than a transition message. In this example, the inclusion of both types is intentional to demonstrate the differences between the two message types. The validation is assigned to the draft determine action prepare, i.e. draft data is validated before the transition to active data.
For more information, see the comments in the code.