ABAP RAP Advanced

Actions with Parameters

Parameterizing Actions

What Are Actions with Parameters?

  • Non-standardized operations on RAP objects
  • Allow additional user input for processing
  • Parameters provide details required for execution
  • Example: Change status with a comment as parameter

Defining Parameter Structures

  • Model parameters as a separate abstract CDS entity
  • Structure contains all necessary fields for the action
  • Example structure:
@EndUserText.label : 'Status Action Input Structure'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #STRUCTURE
define structure zkp_status_ae {
    status_code : abap.char(10);
    comment : abap.string;
}

Action with Parameter in Behavior Definition

  • Link the parameter structure to the action using the parameter keyword
  • Optionally, return a result using result
  • Example:
define behavior for ZI_Your_Root_Entity persistent 
table ZYourTable 
lock master 
authorization master ( instance ) {

    action resetStatus parameter zkp_status_ae result $self;​
}

Implementation in the Handler

  • Parameters are received via the keys tables
  • Access parameter values through structure instances in keys
  • Process parameters and update BO status
  • Return the result to the UI or caller

UI Integration and User Experience

  • RAP automatically generates UI dialogs for parameter actions
  • Fiori Elements displays a popup for parameter input
  • No explicit UI5 coding required for parameter handling
  • Supports multi-selection, mandatory fields, and validations

Best Practices

  • Always model parameters clearly and semantically
  • Mark mandatory fields with mandatory:execute
  • Use return parameters to provide UI feedback
  • Version and document parameter structures

Summary

  • Actions with parameters extend RAP objects functionally
  • Enable flexible, user-driven processes
  • Support clean separation of data and control logic
  • Strong integration with Behavior Layer and Fiori UI