BOPF and the ABAP Programming Model for SAP Fiori
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Before RAP existed, a team that wanted an expense-claim app for the browser built it in a different way: a CDS view described the data, a framework called the Business Object Processing Framework (BOPF) held the business rules, and a handful of annotations told the system to connect the two and publish the result as a web service. SAP calls that recipe the ABAP Programming Model for SAP Fiori. You will still meet it in older books and in old code of on-premise systems. This page explains the model in plain words, shows its pieces next to the RAP pieces they became, says why RAP replaced it, and describes what SAP’s migration tool really does with an old business object, which is less than the word "migration" suggests. The model belongs to the on-premise ABAP Platform: SAP states that it has been generally available since ABAP Platform release 7.50 SP00, and its guides are part of the ABAP Platform documentation, read here for SAP S/4HANA on premise 2025 FPS02 and ABAP release 8.16. It is not a model for new development in ABAP Cloud, for which RAP is the model. No listing of this page can run in the lab of this site, because BOPF, CDS annotations and the migration tool need a full SAP system with ADT, so every listing is labelled as requiring an SAP system and was not run here.
Before you read
-
CDS View Entities: what a CDS view is and how it reads a table.
-
CDS Annotations and Metadata Extensions: what an annotation is and what the claim view
ZI_ExpClaimlooks like. -
CDS Associations, Compositions and Path Expressions: how a claim and its items form a tree.
-
Classes and Objects: BOPF logic lives in global classes that implement an interface.
-
RAP Overview: the successor model; the comparison below assumes you know its parts.
-
Behavior Definitions and Implementations: where determinations, validations and actions live in RAP.
-
Managed, Unmanaged and Unmanaged Save: the implementation types that a rebuilt business object chooses from.
Key terms
-
BOPF: the Business Object Processing Framework, a runtime that holds a business object as a tree of nodes together with its business logic.
-
Node: one level of the tree of a BOPF business object, with its own attributes and logic.
-
ABAP Programming Model for SAP Fiori: the model of the 7.5x era that combined CDS views, BOPF and SAP Gateway to build transactional Fiori apps; the predecessor of RAP.
-
Determination: logic that runs automatically after data changes, for example to calculate a total.
-
Validation: logic that checks data and never changes it.
-
Action: a named operation of a business object, such as "submit a claim".
-
BOPF-based RAP business object: the result of SAP’s migration tool; a RAP business object whose runtime is still provided by BOPF.
The model of the 7.5x era
The ABAP Programming Model for SAP Fiori defines, in SAP’s words, the architecture for efficient end-to-end development of SAP HANA-optimized Fiori apps in SAP S/4HANA. It was meant for all kinds of Fiori apps (transactional, search, analytics and planning) and is based on three technologies: Core Data Services for the data model, the OData protocol with SAP Gateway for the web service, and ABAP application services for custom logic. For transactional apps, which change data, the logic part is a lightweight CDS-based flavor of BOPF. The guide gives the history in one paragraph: with ABAP release 7.4 SAP introduced CDS and brought SAP Gateway into the application server, and with release 7.5 BOPF also became part of the ABAP platform, which is why this model starts with ABAP Platform 7.50 SP00.
The central idea is that you do not write the framework object yourself. You write a CDS view and mark it with annotations; when you activate it, the system generates a BOPF business object that is named after the view. The consumer, usually a Fiori app, never talks to BOPF directly. It talks to an OData service that was built on a second CDS view, the consumption view.
Source: ABAP Programming Model for SAP Fiori and RAP: ABAP RESTful Application Programming Model. The right-hand column is the reading aid of this page, not a table published by SAP; the next sections justify each pair.
The data model: annotated CDS views
A BOPF business object of this model starts as a CDS view that carries a set of @ObjectModel annotations. The guide calls it the
business object view. It needs the annotations in the table below on the root view; the guide adds that the root view’s
annotations are what trigger the automatic generation of the BOPF object.
| Annotation on the root view | What it does |
|---|---|
|
Marks the view as a business object for the Virtual Data Model. Optional and without runtime effect; recommended on the root. |
|
Says that this view is the root of the tree of the business object. |
|
Switches on transactional runtime support. |
Every entity that can be edited, the root included, also needs these:
| Annotation on every editable entity | What it does |
|---|---|
|
Names the table or database view that receives the changes. |
|
Allows creating instances. |
|
Allows changing instances. |
|
Allows deleting instances. |
Applied to the running example, the head of such a view for the claim would look like the listing below. The element list is
left out on purpose: the guide warns that table field names and view element names must be the same apart from upper and lower
case, otherwise activation fails, and the field names of zexp_claim contain underscores that the camel-case element names of
ZI_ExpClaim do not. The names ZEXPCLAIMTX, ZI_ExpClaim_TX and ZEXP_CLAIM belong to the running example; everything else
is the annotation set of the SAP guide. It requires an SAP system; not run here, because it needs the CDS compiler and the
BOPF generator of an ABAP system.
@AbapCatalog.sqlViewName: 'ZEXPCLAIMTX'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Expense claim for transactional app'
@ObjectModel.semanticKey: 'ClaimId'
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@ObjectModel.compositionRoot: true
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.writeActivePersistence: 'ZEXP_CLAIM'
@ObjectModel.createEnabled: true
@ObjectModel.updateEnabled: true
@ObjectModel.deleteEnabled: true
define view ZI_ExpClaim_TX
as select from zexp_claim
{
-- element list left out
}
Source: Adding Business Object Semantics to Data Model and Keyword Documentation: ObjectModel.transactionalProcessingEnabled
Two details separate this style from today’s CDS. The view is a classic, DDIC-based view with @AbapCatalog.sqlViewName, written
as define view, while CDS View Entities use define view entity and
need no SQL view name. And the generated BOPF business object gets a name in capitals taken from the view name, a constants
interface with a constant for every node and attribute, and Dictionary objects, all visible in the BO editor of ADT.
Nothing in the business object view exposes it to a browser. For that, SAP puts a second view on top, the consumption view. It repeats the annotations that have view scope, because only element and association annotations are inherited, and it says that the work is delegated to the view below.
@ObjectModel: {
transactionalProcessingDelegated: true,
compositionRoot: true, -- on the root only
createEnabled: true,
updateEnabled: true,
deleteEnabled: true
}
Source: Defining the Consumption Layer. This fragment is the annotation block of that page without the surrounding view; it requires an SAP system; not run here.
transactionalProcessingDelegated: true means that requests to the consumption view go to the transactional runtime of the view
below it, the one marked with transactionalProcessingEnabled. To allow drafts, the root consumption view adds
draftEnabled: true.
The behavior: nodes, determinations, validations and actions
In BOPF, a business object is a tree of nodes. A node groups the attributes that belong together and the business logic for them; for a claim, the root node is the claim and a child node holds the items. For each node the developer can define several kinds of entity, which the BOPF guide lists as actions, alternative keys, associations, authorization checks, determinations, queries and validations. The three that carry business rules are the ones that RAP also has.
-
A determination is an entity that runs automatically when a trigger condition is met. The condition is a determination time plus the kind of change on the node: create, update, delete or load. The BOPF guide names the times "after modify", "check and determine", "finalize" and "during save". It also says that several determinations can depend on one another (the item amount must be calculated before the total), and that such a dependency is declared explicitly. During save, a determination must not stop the instance from being saved.
-
A validation checks data and never changes it; it only returns messages and the keys of the instances that failed. An action validation decides whether one particular action may run on an instance. A consistency validation checks that an instance is consistent and can prevent the save until it is corrected.
-
An action is a service of the business object that belongs to one node, for example releasing an invoice or setting a sales order to paid. It can work on several instances, on exactly one, or on none (a static action), and it can return data to its caller.
Each of the three is implemented by a global ABAP class. The class implements one interface of the framework: the interface
/BOBF/IF_FRW_DETERMINATION for determinations, /BOBF/IF_FRW_VALIDATION for validations and /BOBF/IF_FRW_ACTION for
actions. Each interface has a method EXECUTE that does the real work; other methods that the interfaces list are marked as
deprecated and must not be implemented. A consumer or another piece of code can also call checks on purpose: the guide names the
methods CHECK_ACTION, CHECK_CONSISTENCY and CHECK_AND_DETERMINE of the service manager interface
/BOBF/IF_TRA_SERVICE_MANAGER.
Source: BOPF Developer Guide: Business Object Metadata Model, Determinations for CDS-Based Business Objects, BOPF Validation, Actions for CDS-Based BOPF Business Objects and Understanding the Determination API
In the 7.5x model, the developer creates these entities in the BO editor of ADT, not in a text file: a wizard asks for a name, a
description, an implementation class and, for an action, the instance multiplicity. The framework then creates the class with
the empty interface methods, and the developer fills in EXECUTE. The BO editor works on the object generated from the CDS
view; the definition of the object is therefore spread over annotations, generated artifacts and classes, whereas in RAP it is
one readable behavior definition.
A BOPF validation in code
The listing is the core of the validation that the SAP guide builds for the items of a sample sales order: it reads the item
instances it was asked to check and, for every item with a negative quantity, reports the item as failed. The lines that fill a
message object are left out of this excerpt, because they only say where and how the message is shown. The names
lt_sales_order_item, ztdemo_i_salesorderitem_tp_d and quantity are the SAP sample’s, not those of the running example. It
requires an SAP system; not run here.
METHOD /bobf/if_frw_validation~execute.
DATA lt_sales_order_item TYPE ztdemo_i_salesorderitem_tp_d.
io_read->retrieve(
EXPORTING
iv_node = is_ctx-node_key
it_key = it_key
IMPORTING
et_data = lt_sales_order_item
eo_message = eo_message
et_failed_key = et_failed_key ).
LOOP AT lt_sales_order_item ASSIGNING FIELD-SYMBOL(<s_sales_order_item>).
IF <s_sales_order_item>-quantity < 0.
" ... build the message in eo_message (left out here) ...
APPEND VALUE #( key = <s_sales_order_item>-key ) TO et_failed_key.
ENDIF.
ENDLOOP.
ENDMETHOD.
Reading it: the framework passes the keys of the instances to check in it_key and a reader object in io_read. The method
asks the reader for the data (retrieve), loops over it and collects the keys of failing instances in et_failed_key; the
guide stresses that a validation does not modify the instances. The comment inside the loop stands for the message code that
the original contains. If you compare this with the handler method of a RAP validation in
Behavior Definitions and Implementations, you will recognise the
same shape: read the instances, test them, and report the failing ones in a result structure.
Drafts in the BOPF model
A Fiori app often lets the user stop halfway and continue later, even from another device. The model supports this with
draft handling: the app keeps two versions of an instance, the active data, which is the saved state of the business, and the
draft data, a temporary state in a separate draft persistence until it is activated. The guide lists the requirements that a
newcomer would otherwise discover late: the key of the data model must be UUID-based, as native in BOPF; the application server
must be at least AS ABAP 7.51 innovation package SP02; and the ADT client must be version 2.73 or higher. Each root node of a
draft business object has a technical field DRAFTENTITYCONSISTENCYSTATUS with the values pending, consistent and inconsistent;
the status is evaluated on demand by the action PREPARATION, and a draft can only be activated when it is consistent. In
the consumption view, draftEnabled: true on the root switches drafts on.
RAP has the same idea under the same name, including a draft action Prepare; the later page on draft handling explains the
RAP version.
Why RAP replaced it
SAP’s RAP guide gives the reason in two sentences. RAP was designed to improve upon the ABAP Programming Model for SAP Fiori and to incorporate the lessons learned from it. It enhanced key architectural concepts that are now integral to ABAP Cloud, such as separating the business logic implementation from the protocol-specific parts, so that the same RAP business object can be exposed for OData V2 and for OData V4 and the same implementation serves several business services. In practical terms for a reader of old code:
-
The definition of behavior moves from annotations plus a BO editor plus generated objects into one text artifact, the behavior definition, which is checked at activation and can be read from top to bottom.
-
The logic classes change from one global class per determination, validation or action, each implementing a BOPF interface, to the methods of a behavior pool, with typed parameters and the same pattern for every kind of logic.
-
The service layer is generated from projection views and service bindings, and RAP business objects can be consumed from ABAP with EML, which a later page explains.
-
RAP is part of ABAP Cloud and its documentation is valid for SAP S/4HANA Cloud Public Edition, Private Edition, the ABAP environment and SAP S/4HANA; the BOPF guides are published in the ABAP Platform documentation of the on-premise product.
From BOPF to RAP: where each piece went
SAP does not publish a table that maps every BOPF concept to a RAP statement, so the table below is a reading aid built from the two sets of documentation. The left column is from the BOPF guides, the middle column from the RAP keyword documentation and the behavior definition page of this section; the right column names the places where the two models do not match.
| BOPF (ABAP Programming Model for SAP Fiori) | RAP | Caveat |
|---|---|---|
Business object view with |
Root view entity with child view entities, plus a behavior definition |
In RAP a root entity is declared as a root and children are linked by composition and to-parent association; see CDS Associations, Compositions and Path Expressions. The running example’s |
Node |
Entity of the business object |
A node is part of the framework’s tree; an entity is a CDS view entity with its own alias in the behavior definition. |
Determination, time "after modify" |
|
The BOPF guide describes more times (check and determine, finalize); the RAP keyword documentation shows |
Determination, time "during save" |
|
Same caveat. The BOPF guide requires that a determination during save does not stop the save. |
Consistency validation |
|
BOPF trigger conditions are configured in the BO editor; in RAP the triggers are written in the behavior definition, for example |
Action validation |
Feature control or a check inside the action |
The BOPF framework runs an action validation automatically before the action. RAP has no automatic pair; see the feature-control section of Behavior Definitions and Implementations. This pairing is the page’s reading, not a statement of SAP. |
Action with instance multiplicity |
|
The BOPF choice "single node instance" has no direct switch in RAP; the handler receives the keys of one or more instances. |
Consumption view with |
Projection view and projection behavior definition |
Later page of this section. |
|
Draft handling switched on in the behavior definition |
Later page of this section. |
Persistence named in |
|
Managed implementation only; an unmanaged business object saves through its own code. |
Source: Keyword Documentation: ABAP RAP Business Objects, Keyword Documentation: RAP - Determination, Keyword Documentation: RAP - Validation and Keyword Documentation: RAP - action
The same three business rules of the running example, written in RAP, are three lines of the behavior definition. They are the
lines of Behavior Definitions and Implementations reduced to the
shapes shown in SAP’s own sample definitions; the names setStatusNew, validateAmount and submit belong to the example.
The listing requires an SAP system; not run here.
determination setStatusNew on modify { create; }
validation validateAmount on save { field TotalAmount; }
action submit;
Moving an existing BOPF business object
There are two different things that people mean by "migrating a BOPF object to RAP", and the SAP documentation separates them.
What the migration tool does
ADT contains a migration wizard for CDS-based business objects of the 7.5x model. SAP’s what’s-new entry for it is valid as of ABAP Platform 2023, and the RAP BDL release news list it for ABAP release 7.58. The tool needs a one-time enabling: the documentation names the prerequisite that you enable the migration by raising a ticket to the support component BC-ESI-RAP-MIG-BOF. The procedure from the documentation is short.
-
In your ABAP project, find the CDS-based BOPF business object under BOPF Business Objects in the Project Explorer.
-
Open the context menu and choose RAP Business Object, then Migrate.
-
In the wizard, choose a mode: Simulation checks and tests for errors and warnings and migrates nothing productively; Migration migrates all related objects.
-
Check the list of transactional processing views and of consumption views that the migration affects.
-
For a migration, select or create a transport request.
-
Choose Finish and read the log in the BO Migration Log view. Errors and warnings mean manual work after the migration.
The documentation adds two warnings. The migrated business object cannot be reverted, so the simulation comes first, and the migration log can be shown again later with the action View Migration Log.
The result is the surprise. SAP states that the tool migrates CDS-based BOPF business objects to BOPF-based RAP business
objects, which are not native RAP business objects and are not enabled for use in ABAP Cloud, and for that reason it says that
a migration with this tool is not recommended. A BOPF-based RAP business object has its own behavior definition, written with
the header managed by BOPF. The keyword documentation says it cannot be built from scratch, that its transactional buffer is
provided by the BOPF-managed RAP BO provider, that drafts are handled by the BOPF-managed RAP draft provider, and that it has a
limited feature set compared with a managed or unmanaged RAP business object, because some features work differently when
BOPF manages the requests. The documentation’s own sample, generated by the tool, shows the shape.
//GENERATED BY MIGRATION TOOL
managed by BOPF
implementation in class BP_DEMO_RAP_BOPF unique;
strict(2);
define behavior for DEMO_RAP_BOPF
persistent table demo_dbtab_root
authorization master ( instance, global )
lock master
{
create;
update;
delete;
}
Source: Keyword Documentation: RAP - managed by BOPF. The names are SAP’s demo names. The listing requires an SAP system; not run here.
Rebuilding as a native RAP business object
To end up with a native managed (or unmanaged) RAP business object, the tool is therefore not the route; the work is a rebuild in the RAP way. The current RAP guide on implementation types gives the guidance for choosing. The managed implementation type is aimed at building new applications from scratch without existing business-logic code, and the guide says plainly that integrating existing logic into a managed business object can hardly be achieved. The unmanaged implementation type is aimed at developers whose business logic already sits in function modules, which can be called from the behavior methods. A managed business object can also modify its save sequence with an additional or unmanaged save when data must go to other tables. BOPF logic classes are none of these, so the practical plan is: keep the table, model it again as view entities with a composition tree and a behavior definition, and carry the rules over one by one into determinations, validations and actions of a behavior pool, using the table above as the checklist.
Source: RAP: Business Object Implementation Types and Migrating CDS based BOPF BO to RAP BO. The rebuild path is this page’s reading of the implementation-type guidance; SAP’s migration page only points to a separate document on ABAP-based extensions for the move from the Fiori programming model to RAP.
The key point for planning: when the target is ABAP Cloud or a clean core, a BOPF-based RAP business object is a stopover, not the destination. For an on-premise system that keeps running its BOPF-based apps as they are, the model remains as it was delivered; nothing on the pages read for this page forces a change.
What older books show, and what has changed
A SAP PRESS book on the ABAP RESTful Programming Model from 2019, written for SAP S/4HANA 1909 and AS ABAP 7.54, describes the
BOPF-based model next to a very early form of RAP. Its chapters on the CDS and BOPF model help to read old code. Its RAP parts describe a very early RAP and are out of date for
new development: for example, in strict mode of the behavior definition the keyword implementation in the header
must not be used any more, which the Keyword Documentation states. Use the book to understand a legacy object, and use the
RAP pages of this section for anything you write today.
Source: SAP PRESS: ABAP RESTful Programming Model (publisher page) and Keyword Documentation: RAP - Implementation Type
Summary
-
The ABAP Programming Model for SAP Fiori of ABAP Platform 7.50 and later builds a transactional app from annotated CDS views and a generated BOPF business object, with determinations, validations and actions as classes behind framework interfaces.
-
A consumption view with delegated transactional processing exposes the business object as an OData service, and
draftEnabledadds drafts. -
RAP was designed to improve on this model: one behavior definition instead of annotations plus editor plus generated parts, and a service layer separated from the logic so that one business object serves OData V2 and V4.
-
The migration wizard does not produce a native RAP business object. It produces a BOPF-based RAP business object with a limited feature set that is not enabled for ABAP Cloud, and SAP says it does not recommend the tool; the migration cannot be reverted, so start with the simulation.
-
A native managed or unmanaged RAP business object is a rebuild: keep the table, define view entities and a behavior definition, and move the BOPF rules into a behavior pool.