ABAP RAP Advanced

Instance Creation

Create Validations and Default Values

Mandatory Field and Value Help for Projects

  • Tasks must always be assigned to a project
  • Mark project as a mandatory field in Behavior Definition (BDEF)
  • Create and optimize value help ZC_##_ProjectVH for projects
  • Add association to project in the Task I-View
  • Extend projection ZC_##_Task with a field for project name

Validations During Create (Prechecks)

  • Implement prechecks directly in the create process
  • Validation is done via create ( precheck ) in BDEF
  • Check mandatory field “Project” in the precheck method code
  • Errors are reported through the Behavior Framework

Default Values During Create: Determination

  • Implement default values (e.g., Task Type) via determination
  • Create value help view ZC_##_TaskTypeVH for task types
  • Define determination getDefaults on modify { create; }
  • Implementation fills fields with default values during creation
  • Add value help in both task projections (Draft and Non-Draft)

Handling Without Draft: UI-Based Default Function

  • Create occurs only when user clicks “Create”
  • Implement static function DefaultForCreate in BDEF
  • Implementation provides default parameters (e.g., Task Type) via CID
  • Advantage: Convenient defaulting in non-draft scenarios
  • Requirement: ABAP Platform 2311 / S/4HANA 2025 (on-prem)

Summary

  • Mandatory fields ensure data integrity
  • Prechecks allow comprehensive validations during create
  • Determinations simplify defaulting and improve UX
  • Different strategies for draft and non-draft scenarios
  • RAP offers flexible mechanisms for clean object instantiation