You are on page 1of 54

Business Object Layer

Contents

Introduction Mobile Client Application Development Business Object Layer Design Time Business Object Layer Runtime Authorizations Looking Ahead

SAP AG 2002, Business Object Layer, 2

Demand for Mobile Business Solutions

The demand for mobile business solutions increased the number of mobile online and offline applications. EXAMPLE The mySAP CRM Mobile Sales Client, which was designed as a flexible complement to R/3, requires a laptop solution that meets the following criteria:

Thin Easy to maintain Easy to integrate into other PC tools and applications

SAP AG 2002, Business Object Layer, 3

mySAP Mobile Solutions Offer


Example: mySAP CRM Mobile Sales

Quick identification of most important information Overview and easy access to details Backward and Forward for fast navigation Hyperlinks to related information

SAP AG 2002, Business Object Layer, 4

Mobile Client Application Architecture


Multi Tier Paradigm
Provides a truly scalable and robust solution that supports distributed computing over the Internet. The application structure must include several independent layers that communicate with each other through well-defined interfaces. Separate Layers make it possible to provide different types of Mobile Clients (from Fat to Thin) by moving the application layers between the Client and Server platforms.

SAP AG 2002, Business Object Layer, 5

Mobile Client Application Architecture


The Mobile Client Application is based on an object oriented software development approach. The application is split into three tiers UIL, BOL and BDL

User Interface Layer (UIL) This layer interprets data for the user.

Business Object Layer (BOL) This layer validates user input, business rules, and other standard operations such as Save, Delete, Revert, and so on. This layer provides data to the UIL.

BDoc Layer (BDL) This layer provides an abstraction over the underlying database and provides the required object oriented wrapper over relational data.

SAP AG 2002, Business Object Layer, 6

Business Object Layer Prominent Features

User Interface Layer Interaction Layer

The Business Object Layer is the central place where Business Logic is stored and validation of user data against the Business Logic is performed.

UIL
The Business Object Layer has been designed in such a way that Business Logic could be written independently of the persistency layer (BDL).

Business Object Layer

BOL

The Business Object Layer has been designed to be independent of the presentation of the data (independent of the UIL). The Business Object Layer is generic enough to provide for Customization of the Business Objects to meet specific Business Requirements.

BDoc Layer

BDL

UDB

SAP AG 2002, Business Object Layer, 8

Business Object Layer

Facts
User Interface Layer Interaction Layer

UIL

COM/DCOM interface

Business logic via VBA


Benefits

Business Object Layer

BOL

Component based Standard automation interface Scalable for all MS Windows


platforms

BDoc Layer

BDL

Flexible customization Extendability of Business Object


Model

UDB

SAP AG 2002, Business Object Layer, 9

Contents

Introduction

Mobile Client Application Development Business Object Layer Design Time Business Object Layer Runtime Authorizations Looking Ahead

SAP AG 2002, Business Object Layer, 11

Mobile Client Application Development (1)


Mobile Client Application Development

Application Developer
R

1
Repository based application development
Development Environment

Designing the Mobile Client Application with the Mobile Application Studio
one tool integrates all development tasks rapid application development based on MCA metamodel stores metadata of application framework in a repository

Mobile Application Repository

SAP AG 2002, Business Object Layer, 13

Mobile Client Application Development (2)


Mobile Client Application Development

Declarative programming enables multiple client solution deployment

Application Developer
R

Application Deployer
R

Development Environment

2a
Smart Client Application Generator

Smart Client
R

Generators for multiple solution targets


Mobile Application Repository

Runtime Components

SingleUser

2b
Generating the Runtime Components
automated template-based based on specific version of development objects in repository
Thin Client Application Generator

Multi-user Application Server


Runtime Components

Thin Client

SingleUser

2c
add-on generator
Runtime Components

additional runtime scenario

SAP AG 2002, Business Object Layer, 14

Design Time and Runtime


Design Time Runtime Mobile Client Application
User Interface Layer

Mobile Application Studio


Front End Set of visual modeling tools, e.g. for screen elements and business objects

Business Object Layer


Screen Elements Business Objects

Other Systems

Application Repository Interface

BDoc Layer

Generator

CRM Server Middleware


Synchronization

UDB
Mobile Application Repository HTML, VBA DLLs, Control Files, metafiles (arsrep.dat, msginfo.dat)

CDB

SAP AG 2002, Business Object Layer, 15

Generation using Mobile Application Studio


Generation
MARRT Generator Generates meta information about the modeling components
VBA Generator Generates customized code into VBA Class modules

SAP AG 2002, Business Object Layer, 16

Contents

Introduction Mobile Client Application Development

Business Object Layer Design Time Business Object Layer Runtime Authorizations Looking Ahead

SAP AG 2002, Business Object Layer, 17

Business Scenario: Business Logic Objects


Business Objects Properties of Business Objects Business Object Relations

owner 1

Business Partner Customer No. Name

owner 1

* orders

Order Order No. Order Date Headword Net value Currency

Product Material No. Material Grp. Material Type

1 owner 1 product

1 order

* addresses
0..1 default address Address Name Street House No. City Zip Code

items *
OrderItem Item No. Quantity Description Currency Net value * order items

Reject if NetValue < $1,000,000 !

Business Rule
Examples
SAP AG 2002, Business Object Layer, 18

Business Object Layer: Object Model


UserDataDictionary Errors MSAErrorInfo BusinessQuery BusinessRootObject BusinessObject Attribute BusinessFactory BusinessCollection ComboEngine ListEngine Attributes

Legend
Framework Collection Framework Object

Modeling Components in Mobile Application Studio

Business Rules could be associated to both BusinessObject and Attribute


SAP AG 2002, Business Object Layer, 19

Modeling Using Mobile Application Studio


Design Time

Mobile Application Studio


Front End Set of visual modeling tools, e.g. for screen elements and business objects

Screen Elements

Business Objects

Modeling Components
Application Repository Interface

Business Objects
Business Queries Combo Engines Business Rules

Generator

Mobile Application Repository

SAP AG 2002, Business Object Layer, 20

Business Objects
Business Object
Represents a physical or logical entity in a business scenario,

such as Customer, Address, or Order.


Framework implements a Generic Business Object exposing

standard methods, properties and event handlers. Generic BO is extended using VBA where new methods and properties can be added. Is characterized by :
Business

Object Type

Properties Methods Event

Handlers to other Business Objects

Relations

Business
User

Rules

Exits

SAP AG 2002, Business Object Layer, 21

Business Object Properties


Business object properties:

Characterize a business object


Example: country, zip code, or street name characterize an address

Can take simple values (for example, a string or number) Comprise the state of a business object during runtime

Default Address

Name City Street Zip Code House No.

SAP AG 2002, Business Object Layer, 22

Business Object Methods


Business object methods:

Are operations that can be performed on a business object Define the behavior, business logic, of a business object Example: Configuration rules for a product Can be called from other business object methods or from the UI Are written in Visual Basic for Applications (VBA)

SAP AG 2002, Business Object Layer, 23

Business Object Event Handlers


Events are messages sent within a program when specific user actions occur for example, when you create, change, save, or delete a business object. Event handlers that is, pieces of program code can be connected to these events. If an event is fired, the corresponding code will be executed.

Example: Event Handlers of Business Object BOCAPGEN

SAP AG 2002, Business Object Layer, 24

Business Object Relationships


EXAMPLES for relationship options
Cardinality
Single: Order Item Multiple: Order

Order Item Status

Order Items

Optional in relation
True: Business Partner

Contact Order

False: Business Partner

Relation[ship] type
Child: Order

Order Items Order

Normal: Business Partner

Action if deleted
Cascaded: Order

Order Items Contact

None: Business Partner

SAP AG 2002, Business Object Layer, 25

Business Rules
You use Business Rules to implement constraints on a business objects state, in order to ensure business object model consistency. Examples
Ensure that a certain condition is true for a business object at any time, for example, the start date of an appointment must be before its end date. Prevent the deletion of a business object, for example, once an order has been uploaded to a backend system, it must not be deleted in Mobile Sales.

SAP AG 2002, Business Object Layer, 26

Business Object SaveRules / DeleteRules

Business Rules:
Are assigned to a business object or business object property Are implemented as Boolean functions
Save rules (triggered when you save a business object) Delete rules (triggered when you delete a business object) Property rules (triggered when you change a business object property)

Are called automatically

SAP AG 2002, Business Object Layer, 27

Business Rules: Priorities


Every business rule assigned to a business object or business object property has a priority per category (Save Rules, Delete Rules) which determines the order in which the business rules are triggered:
EXAMPLE: The business object BOEMPLOYEE has four Save rules: If you assign AreDatesValid priority 1, and IsLogicalAddressUnique priority 2, AreDatesValid runs before IsLogicalAddressUnique. NOTE: Both business rules could be assigned to another business object as well; in that case, the priorities could be different.

SAP AG 2002, Business Object Layer, 28

Business Object User Exits

User Exits:
Are development objects that represent customer-defined code Are used to enhance the functionality of the existing code in accordance with the customer's requirement Have a name, signature, and VBA code Using SAP-defined user exits does not modify the existing application code (no collisions during upgrade)

SAP AG 2002, Business Object Layer, 29

Business Query
Business Query
Provides a mechanism for retrieving a set of Business Objects

(BusinessCollection) based on Search criteria.


Search parameters are modeled as Properties of a Business Query.

Properties...
Characterize the business objects that result from the query to be executed Accepts simple values (for example, a string or number) Values are not stored in the database

Business Query Properties, similar to Business Object Properties, offer an

additional property Match Type.


Exact match Match At End Match At Begin Match Sub String Match Advanced Match Exact Empty

SAP AG 2002, Business Object Layer, 30

Business Query Result: Business Collection


Business Collection (BCOL)
A collection of Business Objects. These objects are not necessarily instantiated. The BCOL maintains a reference to the Business Objects belonging to it. It can expose additional information not part of the Business Object type the collection represents. This data is read/write but is not persisted. Not modeled in Mobile Application Studio. Can be retrieved either as a Relation or as a return Value from a Business Query.

They are comparable to COM collection objects. Methods of a BCOL


Save, Find

create and delete business objects.

the business object through index or its ID. The ID can be viewed as a unique key for that object. the contained objects.

List

SAP AG 2002, Business Object Layer, 32

Combo Engine and List Engine


Combo Engine
Component behind the UI dropdown

COMBOINPUT control Mapping functionality


Attached to a Business Object Property Modeling
Modeled BDoc

in Mobile Application Studio

definition required

Hierarchy

information when required

List Engine
Represents BDoc Layer record set

Used internally by the Combo Engine

SAP AG 2002, Business Object Layer, 33

Contents

Introduction Mobile Client Application Development Business Object Layer Design Time

Business Object Layer Runtime Authorizations Looking Ahead

SAP AG 2002, Business Object Layer, 35

Mobile Client Application - Runtime


Runtime Mobile Client Application
User Interface Layer

Business Object Layer

Other Systems

BDoc Layer
Synchronization

CRM Server Middleware

UDB
HTML, VBA DLLs, Control Files, metafiles (arsrep.dat, msginfo.dat)

CDB

SAP AG 2002, Business Object Layer, 36

Business Object Layer: Object Model


UserDataDictionary Errors MSAErrorInfo BusinessQuery BusinessRootObject BusinessObject Attribute BusinessFactory BusinessCollection ComboEngine ListEngine Attributes

Legend
Framework Collection Framework Object

SAP AG 2002, Business Object Layer, 37

Business Object Layer: Components

BusinessRootObject
Gateway into the Business Object Layer Initializes the dependent services VBA, Application Repository, BDoc Layer Creates service components of the Business Object Layer Business Factory, UserDataDictionary, Error Storage Component, Business Object Manager

BusinessFactory
Creates the components exposed by the Business Object Layer
Business Object Business Collection Business Query Combo Engine List Engine

SAP AG 2002, Business Object Layer, 38

Creation of a Business Object: Memory Representation


Step 2: Business Factory creates an instance of Kernel Business Object Step 1: User asks the Business Factory to create a Business Object
R

Business Object Layer


Business Object (Kernel Object)
R

Step 3: Kernel Business Object asks VBA Host to create an instance of extended Business Object

MAR Runtime
R

MAR Runtime Repository

Business Factory

VBA Host
R

Step 7: Kernel Business Objects pointer is returned as a return value to the CreateBusinessObject call

R R

Step 4: VBA Host returns an instance of the extended Business Object

Data Access Layer (BDoc Layer) Step 5: Kernel Business Object asks the Data Access Layer to fetch the record set corresponding to that instance of the BO

Step 6: Data Access Layer returns the record set corresponding to that instance of the BO

Application Data (UDB)

SAP AG 2002, Business Object Layer, 39

Runtime Components File Names


The Interpreter of the Message Information Store: MsgInfoAccess.dl l

Business Object Layer Framework sfabof.dll

Error Component: ErrComp.dll


R

Business Object Layer


Business Object (Kernel Object)
R

MAR Runtime Repository ARSRT.dll

MAR Runtime
R

MAR Runtime Repository

Business Factory

VBA Host
R R

BDoc Layer TLRecset.dll, Tlx.dll, TLRowset.dll TLResMan.dll

VBA Host vbahost.dll


Data Access Layer (BDoc Layer)

Application Data (UDB)

SAP AG 2002, Business Object Layer, 40

Contents

Introduction Mobile Client Application Development Business Object Layer Design Time Business Object Layer Runtime

Authorizations Looking Ahead

SAP AG 2002, Business Object Layer, 41

Basic Concepts

What is authorization?

Permission to read, create, modify, and/or delete data

What is a role?

The collection of activities that a person performs when participating in one or more business scenarios in an organization.

What is a user?

Users can include end users, system administrators, and content managers (that is, project teams and consultants). In the mobile scenario, the user is a business partner with the role Employee.

SAP AG 2002, Business Object Layer, 42

Authorization Management: Procedure

n:m EMPLOYEE ROLE AUTHORIZATION

Authorizations are assigned:


On the basis of user roles.

In two steps. An employee is:


Assigned to user role(s) Granted authorizations

No coding is required; customizing is done via the Authorization Management Tool (AMT).

SAP AG 2002, Business Object Layer, 43

Authorization Levels
You can maintain authorizations at several levels:

n:m EMPLOYEE ROLE AUTHORIZATION

Interaction Component Based Business Object Based

Field Group Based Business Object Data

SAP AG 2002, Business Object Layer, 44

Authorization Using Interaction Components


Current Interaction Components which can be protected are:
Application

Business Component Tile set Tile


Application

Tile Set
Business Component

Tile

SAP AG 2002, Business Object Layer, 45

Using Tokens to Define Authorizations

Tokens...
Define the authorization for a class of business objects regarding read, modify, delete, create new. Can be a collection of Authorization Rules which define the valid scope, that is, the authorization for a business object depending on its content, or the data it contains Are true if:
All assigned authorization rules are true (at runtime) OR No authorization rules have been assigned

Tokens

SAP AG 2002, Business Object Layer, 46

Authorization Rules

Authorization Rules:
Authorization Rules
Authorization Variables

Grant access rights based on the data contained in business objects Consist of:
Business object field Comparison type

UserDependent Data

Predefined Values

Contain authorization logic which is filled by either:


Authorization variables or Predefined values

SAP AG 2002, Business Object Layer, 47

Authorization Using Field Groups

Business Object
(and Child Objects)
Set of Properties

A field group consists of a set of business object properties. You use field groups to set authorizations for fields. Field groups can be made dependent on authorization rules. In this case, the authorizations:
Depend on field values Are assigned to field group instances

Field Group

Can include variables

Authorization Rules

SAP AG 2002, Business Object Layer, 48

Architecture

design time

runtime

Authorization Management Tool

NavigationBar / Interaction components (during startup) create BO


R

UI

ACM
R

AMT

Access Control Manager

update rights (after load)

BO Factory

Attribute values Attribute metadata Attribute rights

create BO create related BO

BO Kernel
Auth tables

MAR
Mobile Application Repository

Token evaluation update rights (BO and Attribute rights) get rights (w/o changing BO state)

persistence

UDB
User Database

BDoc Layer

SAP AG 2002, Business Object Layer, 49

Contents

Introduction Mobile Client Application Development Business Object Layer Design Time Business Object Layer Runtime Authorizations

Looking Ahead

SAP AG 2002, Business Object Layer, 50

Where do we go from here


Enhanced Business Logic Layer
Separating UI Validations from Business Validation Providing infrastructure for type-safe programming paradigm

New Data Access Layer


Common Architecture for all Mobile Solutions
Bring together the Modeling world of all Offline Mobile Solutions

Common design time model

Implement the runtime Model Layer of .NET Web Dynpro

SAP AG 2002, Business Object Layer, 51

Appendix

Business Documents (BDocs) Data Binding

SAP AG 2002, Business Object Layer, 52

What Is a Synchronization Business Document (BDoc)?

A container for messages synchronized between Mobile Client Applications and the CRM Server

A BDoc message contains information about data changes and is replicated from the Mobile Client Application to the CRM Server, or vice versa The CRM Server can distribute the changes to:

Other Mobile Client Applications CRM Online OLTP R/3

An interface to the Consolidated Database (CDB)


Access to data is only through a BDoc type. Every time you make changes to data in the Mobile Client Application, the Mobile Client Application must generate a BDoc message and send it to the CRM Server.

SAP AG 2002, Business Object Layer, 53

BDoc Structure
For each BDoc, you must define a BDoc type.
A BDoc type defines how the data is organized. A BDoc message can be considered an instance of a BDoc type.

A BDoc message contains:


All data pertaining to an object
Example: BDoc for Business Partner contains address data, attachments, sales-area-dependent data, etc.

The data of more than one table. The data of a single table within a
BDoc is called a segment.

SAP AG 2002, Business Object Layer, 54

BDoc Types
Synchronization BDocs (sBDocs)
Used for the communication of the CRM Server with mobile clients When changes are stored in the user database, a BDoc message is produced. Changes are synchronized with the CRM Server as a whole (all or nothing) via a BDoc message Mapping of BDoc segments to CDB tables Designed to access single data records UDB Stored in the CDB Mobile Clients Communication Allows replication and realignment Station Previously called Write BDocs

CDB CRM Server

Mobile Application BDocs


Used by mySAP CRM Mobile Client Applications Processed outside the CRM Server Data cannot be changed BDoc messages cannot be created Designed to access a collection of data records (record set) fulfilling certain criteria Previously called Read or Modifiable Read BDocs

UDB
Mobile Clients

Messaging BDocs (mBDocs)


Used for message exchange with CRM Server applications, backend and external systems No exchange with mobile clients Not stored in CDB
CRM Server R/3 Server

SAP AG 2002, Business Object Layer, 55

Use of BDocs in the Business Object Layer


Every business object is related to a segment in a BDoc type.
You must specify:

BDoc name Segment name

To obtain exactly one data record, you must specify a filter for the primary key. This filter is set via a parameter name. Business object properties are mapped to segment fields.

Business Object

Business Object Property

Business Object Layer

BDoc

Segment

Segment Field

BDoc Layer

SAP AG 2002, Business Object Layer, 56

Appendix

Business Documents (BDocs)

Data Binding

SAP AG 2002, Business Object Layer, 57

Data Binding: What Has to Be Connected?


LAYERS:

Screen Element
on UI Tile

UIL

Tile Set
Business Object

Business Object

BOL

Property

BDoc

Segment

Segment

Field

BDL

UDB Database Table


SAP AG 2002, Business Object Layer, 58

Database Table

DBL

Field

Data Binding Between System Layers

Application

Business Component
User Interface Layer Tile Set Tile
Screen Elements
Input Field List Box CheckIcon box

User Database
UDB
Seg. 1

BDoc
...

Seg. 2

Seg. n

Field 1 Field 2 Seg. Field

Seg. Field Seg. Field

Seg. Field

Properties

DB Table

BDoc Layer

BDoc Repository
(Part of CRM Server)

Business Objects

Business Object Layer

SAP AG 2002, Business Object Layer, 59

You might also like