ERPClimb logoERPClimb
Unmanaged RAP
RAP / CDS / ODataadvanced 14 min read

Unmanaged RAP Part 2: Architecture — CDS, BDEF and Transactional Buffer

Preview · a free account unlocks the full lesson

Key takeaway

Set up the complete unmanaged RAP architecture for a brownfield application: CDS views for queries, the full unmanaged behavior definition, the behavior pool layout, and the transactional buffer class you own.

In this lessonShow sections

Explanation

The transactional buffer holds all changes until save, and in unmanaged RAP you're the one who builds it. It should live in a singleton class, keyed by %tky or %pid, and your read methods must return buffered data first before falling back to the database. One field matters above all others: the ETag field must change on every update, or users will start seeing false conflicts.

Part 1 explained when to use unmanaged RAP and implemented locking, numbering and message mapping. This part builds the full skeleton that all the remaining code plugs into.

There are four layers being wired together here. First, the CDS view entities (ZR_PurchReqU, ZR_PurchReqItemU) form the data model and handle the query side — when a Fiori list report asks for "all requests of status S," RAP answers directly from these CDS views via SQL, with your ABAP code never involved in queries.

Second, the behavior definition is the contract: which operations exist, locks, ETags, authorization, numbering.

Third, the behavior pool, ZBP_R_PURCHREQ_U, is your implementation, built from three kinds of local classes — lhc_ handler classes, which run the interaction phase (create, update, delete, read, lock, numbering, actions) and only change the buffer; the lsc_ saver class, which runs the save sequence (finalize, check_before_save, save, cleanup) and is the only place that touches the legacy API's save; and lcl_buffer, the transactional buffer itself, holding static tables of what's been created, changed and deleted in this transaction.

Fourth, the legacy API is the existing function group or class that validates and saves purchase requests.

Tracing through one "save" click shows how these fit together: the user edits in Fiori, which sends an OData request; RAP calls lock, then calls update in lhc_PurchaseRequest; update reads the current state, checking the buffer first and the database second, applies only the sent fields, and stores the result in lcl_buffer; when the user clicks Save, RAP calls the saver — finalize, then check_before_save for the legacy checks, then save for the legacy save itself (within the same LUW), then the framework commits, and cleanup clears the buffer.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.