Cart updating

ShopsvgYour cart is currently is empty. You could visit our shop and start shopping.

Now Reading: ABAP RAP BO Actions with State and Factory Design Patterns – Complete Example

Loading

ABAP RAP BO Actions with State and Factory Design Patterns – Complete Example

svgAugust 30, 2026SAP ABAPSAP RAPMahe

This document provides a complete practical example of implementing Business Object (BO) Actions in SAP ABAP RAP and improving the implementation using the State and Factory Design Patterns.

The document is divided into two parts.

Part 1 covers the initial RAP Business Object implementation, including the database table, CDS view, behavior definition, and behavior implementation class.

Part 2 focuses on the BO Action workflow and demonstrates the implementation before and after applying the State Design Pattern. The initial approach contains repeated action and state-transition logic. This implementation is then refactored using the State Pattern together with the Factory Pattern to separate state-specific behavior and provide a cleaner approach to managing Business Object state transitions.

The document includes the state-transition interface, custom exception class, donation state class, state factory, and individual implementations for the Available, Reserved, Collected, Delivered, and Cancelled states.

A final UML diagram illustrates the relationship between the RAP Business Object, State Pattern components, Factory class, interfaces, and individual state implementations.

Topics Covered

  • SAP ABAP RESTful Application Programming Model (RAP)
  • RAP Business Objects and BO Actions
  • Database Table and CDS View
  • RAP Behavior Definition
  • Behavior Implementation Class
  • BO Action Implementation
  • State Transition Logic
  • State Design Pattern
  • Factory Design Pattern
  • State Transition Interface
  • Custom Exception Handling
  • State Factory Implementation
  • Available, Reserved, Collected, Delivered and Cancelled States
  • Message Handling
  • Before and After State Pattern Comparison
  • UML Design

https://drive.google.com/file/d/129JnqaM7ffGo-APtbCcR6hCrLGfkiFzJ/view?usp=sharing

svg

What do you think?

Show comments / Leave a comment

Leave a reply

Loading
svg
Quick Navigation
  • 01

    ABAP RAP BO Actions with State and Factory Design Patterns – Complete Example