How To Use Authority Checks in Business Object Processing Framework
How To Use Authority Checks in Business Object Processing Framework
How To Use Authority Checks in Business Object Processing Framework
Processing Framework
Summary
This tutorial aims to provide you with the knowledge
required for embedding authorization checks in a Business
Object. The resulting Business Object will deny the access
to data and the execution of actions the user is not allowed
to.
TABLE OF CONTENTS
BEFORE YOU START ...................................................................................................................................... 3
Objectives ......................................................................................................................................................... 3
Prerequisites .................................................................................................................................................... 3
Systems, releases, and authorizations .............................................................................................................. 3
Knowledge ......................................................................................................................................................... 3
DEFINE AUTHORIZATION OBJECTS............................................................................................................. 4
Prerequisites .................................................................................................................................................... 4
Procedure ......................................................................................................................................................... 4
Launch transaction SU20 .................................................................................................................................. 4
Launch transaction SU21 .................................................................................................................................. 4
Result ................................................................................................................................................................ 5
ASSIGN THE AUTHORIZATION OBJECT TO A BUSINESS OBJECT ......................................................... 5
Prerequisites .................................................................................................................................................... 5
Procedure ......................................................................................................................................................... 5
Enable authorization checks .............................................................................................................................. 5
Assign authorization object to root node ........................................................................................................... 6
Define the field mapping .................................................................................................................................... 7
Result ................................................................................................................................................................ 7
RUNTIME .......................................................................................................................................................... 8
Behavior according to the user profile .......................................................................................................... 8
No permissions .................................................................................................................................................. 8
Role for display .................................................................................................................................................. 8
Role to publish a sales quote ............................................................................................................................ 8
Relation between BO service methods and the fields ACTVT and BO_SERVICE ........................................... 9
Performance ..................................................................................................................................................... 9
Result ................................................................................................................................................................ 9
2
How to use authority checks in Business Object Processing Framework
Objectives
The objects we use and create in this tutorial are simplified versions of the sample BO
/BOPF/EPM_SALES_QUOTE. We continue on the example used in the Getting Started with BOPF tutorial.
Prerequisites
In order to be able to perform this tutorial, the following prerequisites have to be fulfilled.
BOPF is part of the Business Suite Foundation Layer. The feature is available in
SAP Business Suite EHP7 SP03.
For modifying a Business Object, your SAP user requires the developer authorization profile
(S_DEVELOP authorization object).
For defining authorization objects, your SAP user requires the authorization for the transactions SU20
and SU21.
In most cases it is unlikely that you have the permissions to create user roles with transaction PFCG and
assign them to users. If you can create the roles described in the last chapter you can test the
permissions in the BOPF test tool (BOBT) or in your own UIs.
Knowledge
3
How to use authority checks in Business Object Processing Framework
Both types of checks are supported by BOPF by the same authorization object. It just has to contain the
predefined authorization fields ACTVT and BO_SERVICE. These fields are used for static and instance-
based checks.
In the case of instance based checks you need to define the fields for the values to be checked. In our
example this is the business partner id.
Prerequisites
You know the transaction SU20 to define authorization fields and SU21 to define authorization objects.
Procedure
In this step you will create the authorization field Z_SQ_BP_ID for the business partner id and the
authorization object Z_SOQ to be used in the business object ZD_SALES_QUOTE.
The transaction SU20 provides the design time for authorization fields. Select the Create button and enter
the authorization field name Z_SQ_BP_ID. Use the data element SNWD_PARTNER_ID as reference field.
The transaction SU21 provides the design time for authorization objects. Select in the Create menu button
the entry authorization object. Confirm the information popup and continue on the next screen. Enter the
object name Z_SOQ and a description. Authorization objects are classified. Enter a classification for test
purposes in the field Class as you are defining a test object. Assign the authorization fields ACTVT,
BO_SERVICE and Z_SQ_BP_ID.
4
How to use authority checks in Business Object Processing Framework
Result
You have created the authorization object which can be used in the business object ZD_SALES_QUOTE.
Prerequisites
You have defined the business object ZD_SALES_QUOTE as described in the Getting Started with
Business Object Processing Framework.
Procedure
In this step you will assign the authorization object to the root node of the business object
ZD_SALES_QUOTE and map the fields. Embedded authorizations are an advanced feature which you
1
cannot define in the transaction BOB, but you have to use the transaction BOBX (BO Builder eXpert mode) .
Launch transaction BOBX and select the business object ZD_SALES_QUOTE via double click. Open the
business object in change mode and mark the check box Business Object has Authorization checks. This
flag enables the authorization checks.
Save the definition.
1
The transaction BO Builder eXpert is available in SAP Business Suite Foundation 7.47 SP03.
5
How to use authority checks in Business Object Processing Framework
Select the root node and mark the check box Node has own checks. The system proposes the library class
/BOBF/CL_LIB_AUTHORITY_CHECK, accept it. Save the definition.
Select the folder Authorization Objects in the navigation pane and choose the function Assign Authorization
Object in the context menu. Enter Z_SOQ as Authorization Object for BO and save the definition.
6
How to use authority checks in Business Object Processing Framework
You can now proceed with the field mapping. Here you relate the fields of the authorization object with the
fields of the BO. This is necessary to call the authorization check with the correct node data at runtime. The
fields ACTVT and BO_SERVICE are automatically mapped. The framework uses this assignment for static
checks. You have only to map the fields defined by you for instance based checks.
Select Authorization Field Mapping in the navigation pane and choose Create Authorization Field Mapping in
the context menu.
Select the authorization object Z_SOQ in the drop down list box for Authorization Object for BO and the field
Z_SQ_BP_ID in the drop down list box for Authorization Field for BO. Select the Business Partner ID BP_ID,
an element of the persistent structure of the root node, as target attribute.Save the definition.
Hint: you can also follow an association. This is useful to define authorization checks with attributes of
another node – for example to check that users are only allowed to display the sales quotes of the
business partners in a certain region. The region is an attribute of the business partner, not of the root
node of the sales quote.
Result
You have assigned the authorization object to the business object. Authorization checks are now executed
by the framework. How the BO services and actions relate to the user profile is described in the next chapter.
7
How to use authority checks in Business Object Processing Framework
RUNTIME
In the previous steps we assigned an authorization object to a BO. The runtime behavior depends on the
user profile. In the following we discuss three different user profile settings.
No permissions
If no role or profile is assigned to the user, the user has no authorizations for the BO. So any activity is
stopped with an error message, for example ‘No authority to display sales quote <sales_quote>’ or ‘No
authority to publish sales quotes’.
With the following user profile the user can display (Activity 03) the sales quotes related to the business
partner ids starting with 1000. He cannot modify them or execute any action.
The following role definition provides access to all sales quotes in display mode.
To grant the permission to execute a BO action use the activity execute (16) and assign the action name to
the BO_SERVICE field.
8
How to use authority checks in Business Object Processing Framework
Relation between BO service methods and the fields ACTVT and BO_SERVICE
The following table provides an overview on how the BO service methods relate to the authorization fields
ACTVT and BO_SERVICE. For example, if the user triggers the MODIFY method by his user input, the
framework checks the permissions for the activities create, change and delete. If he wants to execute an
action, the system checks the permissions for the fields ACTVT with the activity execute and BO_SERVICE
with the action name.
Performance
In the BOPF runtime we implemented several performance optimization strategies: the canonical one
reduces the calls in buffering the results. In addition we implemented an equivalence group design, meaning
that we execute the check for instances which are identical with respect to the check relevant attributes only
once. And last but not least the standard implementation uses the priviledged mode. This means, that
authorizations are only checked once at the beginning of a request. The user is then authorized to access
the data necessary to fulfill the request – even if data from different nodes or business objects is requested -
without further checks.
Result
This tutorial walked you through defining an authorization object and assigning it to a BO. The pure doing is
very simple and can be done at a late phase of the project. So you can carefully discuss data protection
needs with your stakeholders using the user interfaces of the application. The framework cares for executing
the checks consistently.
9
How to use authority checks in Business Object Processing Framework
But you must understand the SAP authorization and role concept as well as the relation between BO
methods and the fields ACTVT and BO_SERVICE to come up with a meaningful authorization concept for
your application.
10
www.sap.com
Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are
registered trademarks of Crossgate AG in Germany and other
countries. Crossgate is an SAP company.
All other product and service names mentioned are the trademarks of
their respective companies. Data contained in this document serves
informational purposes only. National product specifications may vary.