BOPF New Framework for Developers

14
WIPRO TECHNOLOGIES BOPF SAP New Framework for Developers: An introduction Arpit Kumar Agarwal 2/17/2015

description

BOPF New framework for Developers

Transcript of BOPF New Framework for Developers

Page 1: BOPF New Framework for Developers

WIPRO TECHNOLOGIES

BOPF

SAP New Framework for Developers: An introduction

Arpit Kumar Agarwal

2/17/2015

Page 2: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 1

Table of Contents:

Introduction.........................................................................................................................................2

BOPF Architecture ...............................................................................................................................2

BOPF Transaction Model.......................................................................................................................3

BOPF T-Codes………….............................................................................................................................4

Business Object Model………………………..……………………………………………………………………………………………..4

Nodes/Subnodes……………………………………………………………..…………………………………………………….4

Actions……………………………………………………………...………………….……………………………………………….6

Association……………………………………………………………………………………………………………………………..7

Determinations………………………………………………...………………….………………………………………………..8

Validations………………………………………………………...………………….……………………………………………….9

Query………..……………………………………………………...………………….……………………………………………..10

BOPF Enhancement Framework…….…………………………………………………….……………………………………………11

BOPF Integration………………………………………………………………………………………………………………….……………12

Reference………………………………………………………...………………….…………………………………………….…………….13

Page 3: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 2

Introduction

BOPF stands for business Object Processing Framework. As the name implies, this is all about the

business objects (BO) modeling which provides the tool and services to model a business object cycle.

This is complete OO-based framework. Using this framework’s generic services and functionalities,we

can standardize, modularize and save our time during the development. We are already familiar with

some BO frameworks (defined in Transaction SWO1, BOL etc.). BOPF also shares some similarities with

these models but more evolved.

BOPF is not a new framework. In fact, it is broadly used in multiple SAP applications and products i.e.

Transportation Management (TM), Environment, Health and Safety (EH&S), but still very few. Earlier this

was not available for customer development. Now it is released with SAP Business Suite EHP5 SP11,

SAP Business Suite EHP6 SP05, and SAP Business Suite EHP7 and available to customers for their own

development. Using BOPF, we get the whole application infrastructure and integration of various

components (i.e. with FPM, Workflow, SAPUI5, BRF+, PPF etc.). This allows us to rapidly build

applications on a stable and customer-proved infrastructure.

In a typical complex object we have a large ABAP team and the tasks are distributed among all the

developers. Here, it can be difficult to enforce best practices and ensure that each developer accesses

the object data properly. This is as a result of developers not understanding how to access the data. In

short, there's no overarching object model which ensures that business objects are accessed

consistently. Within the BOPF, everything has its place. Business data is modeled consistently in BO

nodes and attributes. Behaviors are defined as actions. Validations are performed automatically via

validation modules. Triggers can be defined using determinations. The relationships between BOs are

defined statically via associations.

BOPF Architecture

Consumer

The consumer is implemented as a user interface or an autonomous process participant. Frequently,

BOPF BOs will be consumed by UI applications such as WDA applications, etc.

Transaction Layer

Interactions with BOs within the BOPF are brokered through a centralized transaction layer which handles

low-level transaction handling details such as object locking, etc.From the perspective of the consumer

layer, interactions with the transaction layer consist of little more than a handful of intuitive API calls.

BOPF Model

The core of the BOPF functionality lies within the BOPF runtime. This layer contains all of the functionality

required to instantiate BOs, trigger their functionality, and so on. the BOPF runtime utilizes the BOPF

model definitions created at design time as metadata for instantiating BO instances, navigating BO

associations, etc.

Page 4: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 3

BO Runtime & Application

The core of the BOPF functionality lies within the BOPF runtime. This layer contains all of the functionality

required to instantiate BOs, trigger their functionality, and so on. The BOPF runtime utilizes the BOPF

model definitions created at design time as metadata for instantiating BO instances, navigating BO

associations, etc. For example, if the consumer calls the DO_ACTION core service, the BO runtime

instantiates and invokes its implementing class and hands over the control to the implementation class.

After the action has been executed, BOPF collects the result and returns it to the consumer.

Buffer and Database

One of the nice things about the BOPF is that it is rather flexible at the persistence layer. Though the end

goal is normally to store BO data within the database, the framework also supports data buffering via

shared memory as well as the definition of transient nodes and attributes that are loaded on demand.

BOPF Transaction Model

You can divide information processing into indivisible units called transactions. All changes that are made

during a transaction must either be cleaned up or saved as a complete unit. A process usually consists of

multiple transactions executed in succession. In the Business Object Processing Framework (BOPF)

transaction model, the executed transactions are divided into several phases.

The following figure illustrates the phases, which are explained below:

Page 5: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 4

BOPF Important T-codes

BOB: Business Object Builder

/BOBF/CONF_UI: Business Object Configuration

BOPF_EWB: Enhancement workbench

/BOBF/TEST_UI: Test Business Object

Business Object Model

• Nodes/Subnodes

Nodes are basic key of the BO. These are arranged hierarchically to model the various dimensions of the BO data and organized underneath a single root node (much like XML). The hierarchy can be nested arbitrarily deep depending upon business requirements.There are several different node types supported by the BOPF. However,most of the time we will beworking with persistent nodes (e.g. nodes which are backed by the database). It is also possible to define transient nodes whose contents are loaded on demand at runtime. These types of nodes

Interaction

Phase

Save Phase

Save

Check Before

Save

Finalization

Cleanup Phase

Page 6: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 5

can come in handy whenever we want to bridge some alternative persistence model (e.g. data obtained via service calls).

Each node consists of one or more attributes which describe the type of data stored within the node.Attributes come in two distinct varieties: persistent attributes and transient attributes. Persistent attributes represent those attributes that will be persisted whenever the BO is saved.Transient attributes are volatile attributes which are loaded on demand.Therefore a node's attributes aredefined in terms of structure definitions from the ABAP Dictionary.

At runtime, a BO node is like a container which may have zero, one, or many rows like the concept ofcontroller contexts with the Web Dynpro programming model.

Page 7: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 6

• Actions

Actions define the services (or behavior) of a BO and assigned to individual nodes within a BO. In the below screenshot we have SAP defined action category.

The functionality provided by an action is defined in terms of an ABAP Objects class that implements the /BOBF/IF_FRW_ACTION interface. Functioning of actions is more similar to the methods of an ABAP Objects class. Implement the class if you want to add actions other than standard (i.e. save, validate etc.)

Page 8: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 7

• Associations

Though BOs are designed to be self-contained, autonomous entities, they do not have to exist in isolation. With associations, we can define a direct and unidirectional relationship from one BO to another.

Here, the product assignments for sales order items is defined in terms of an association with a product BO called /BOBF/DEMO_PRODUCT. This composition technique makes it possible to not only leverage the product BOs data model, but also its behaviors, etc.

Page 9: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 8

• Determinations

According to the aforementioned BOPF enhancement guide, a determination "is an element assigned to a business object node that describes internal changing business logic on the business object".

In some respects, determinations are analogous to database triggers. In other words, they are functions that are triggered whenever certain triggering conditions are fulfilled. These conditions are described in terms of a series of patterns. i.e. "Derive dependent data immediately after modification" or "Derive dependent data before saving" etc.

To get the above screen, right click on the INIT_ITEM_FIELDS and select ‘Guided Procedure’.

Page 10: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 9

The logic within a determination is defined via an ABAP Objects class that implements the /BOBF/IF_FRW_DETERMINATION interface.

• Validations

As the name suggests, this node is used to check internal business logic on the business object.Validations come in two distinct forms:

o Action Validations:Action validations are used to determine whether or not a particular action can be executed against a BO node.

Page 11: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 10

o Consistency Validations: As the name suggests, consistency validations are used to ensure that a BO node is consistent. Such validations are called at pre-defined points within the BOPF BO transaction cycle to ensure that BO nodes are persisted in a consistent state. Each consistency validation configuration contains a trigger condition that is checked by Business Object Processing Framework (BOPF) at several time points during the transaction. If the trigger condition is fulfilled, the consistency validation is executed. If there are inconsistent node instances, a consistency validation behaves in one of the following ways:

� Sending messages to the consumer � Sending messages to the consumer and preventing the transaction from being

saved until the inconsistency is corrected � Sending messages to the consumer and changing a consistency status

variable

o The validation logic is encapsulated within an ABAP Objects class that implements the /BOBF/IF_FRW_VALIDATION interface.

• Query

Queries are BO node entities which allow us to search for BOs using various types of search criteria.Queries make it possible for consumers to access BOs without knowing the BO key up front.Queries also integrate quite nicely with search frameworks. Queries come in two varieties:

o Node Attribute Queries: Node attribute queries are modeled queries whose logic is defined within the BOPF runtime. These simple queries can be used whenever you simply need to search for BO nodes by their attributes (e.g. ID = '12345').

Page 12: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 11

o Custom Queries: Custom queries allow you define your own query logic by plugging in an ABAP Objects class that implements the /BOBF/IF_FRW_QUERY interface.

BOPF Enhancement framework

The BOPF Enhancement Workbench is an application that allows you to enhance existing business

objects in a business object processing framework (BOPF). You can use the BOPF Enhancement

Workbench to create, change, or delete enhancements of business objects in BOPF, and BOPF

enhancements themselves.

At the design time, a base object can be enhanced by more than one enhancement. These

enhancements can also have additional enhancements. All enhancements of one base object build up a

tree hierarchy.

Page 13: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 12

An enhancement can only extend entities that are located in a base object and that are defined as

extensible. You can extend nodes with the following additional entities:

• Subnodes

• Attributes

• Determinations

• Actions

• Consistency validation

You can extend actions with the following additional entities:

• Action validations

o Pre action enhancement

o Post action enhancement

BOPF Integration

We can integrate different components of business applications with BOPF. When using BOPF we don’t

have to care about the development of adapters or integration layers. Below are some such components:

• Dynpro:BOPF provides a standard interface for consumption by the classic Dynpro UI.

• Floor Plan Manager (FPM):FPM is implemented as a Web Dynpro component and can be easily

integrated with BOPF, commonly known as FBI: FPM BOPF Integration. BOPF provides

configurable and codeless integration of FPM and enables you to seamlessly consume the

services of BOPF Business Objects in a modification-free environment.

• SAPUI5:SAPUI5 is designed for building lightweight UIs for casual use.We have some integration

with BOPF to get the backend data.

• Gateway (OData):SAP NetWeaver Gateway enables you to create and maintain data for

consumption by the web (HTML5) and mobile devices (iPhone and Blackberry).The BOPF

integration of the Gateway is based on REpresentational State Transfer (REST) and OData

standards, known as GBI: Gateway BOPF Integration.

Page 14: BOPF New Framework for Developers

BOPF

Arpit Kumar Agarwal | Wipro Technologies Page 13

• Business Object Layer & GenIL:The Business Object Layer (BOL) provides a generic API for

accessing business data. The Generic Interaction Layer (GenIL) enables uniform access to

business data using a stateless request/response format. BOPF provides adapters for BOL and

GenIL integration.

• Post Processing Workflow:With BOPF BOs, you can integrate business processes using the

Post Processing Workflow.

• Business Rules Framework plus (BRF+):BRF+ is a rule engine. It provides a comprehensive

API and user interface for defining and processing business rules and expressions.

With a BOPF-specific expression type, it is possible to create BO data retrieval expressions in BRF+.

These expressions make data of BOs available in BRF+ environments that support any kind of rule

processing.

Reference

1. http://help.sap.com/saphelp_tm80/helpdata/en/0e/4a3aba521342f685bada9dabb32d5f/content.htm

2. http://scn.sap.com/community/abap/bopf