Business Object Delegation
Applies To: Learners in workflows, Business Object.
This document will help people to understand business object delegation which can be further used in workflows
It will give a brief idea of what is Business Object, its components, properties.
And how to delegate a business object and what is delegation and why we delegate a std. business object.
Author : Mamta Verma, Software Engineer, ES-SAP.
Company: Infosys Technologies Ltd
Created on: 6th DEC, 2008
Table of contents
1. Business Object Type - An Introduction.3
2. Role of Business Object types3
3. Business Object Properties3
4. Components of a Business Object4
5. Business Object Statutes5
6. Delegating a Business Object6
1. Business Object Type - An Introduction
Business Object Repository is an object oriented approach used to model Business Objects and processes.
It is a collection of Business Object types and Interface types and also their components like attributes, methods and events.
Business Object type is a representation of any business entity in an SAP system. Example of entity could be an employee, purchase order, etc.
A BO type includes both the data of the entity and the functions it performs. Data is stored in form of BO attributes and functions in form of BO methods. Thus we can understand BO as an object oriented approach to model business entities and processes.
2. Role of Business Object types
Business Object has the following functions:
a. BO reduces the complexity of the SAP system by dividing it into smaller units.
b. At BO level, non-SAP systems can communicate with SAP system. This can be done using BAPIs.
c. BO enables various business components to communicate with each other.
d. BO types acts as entry points to data and functions for an SAP System.
e. BO's can be used in business workflows, ALE and RFC.
3. Business Object Properties
Each business object has the following properties:
a. Object Type ID - It is used for internal identification of the business object.
b. Object Name - It is used for external identification of the business object. Using this property external system can interact with SAP system.
c. Super Type - It is the parent object from which all the components of the BO are inherited.
d. Name - It is a descriptive name of the BO.
e. Description - It is a brief description of the business object type.
f. Application - The application component to which the BO belongs to.
g. Program - Program that will contain the ABAP code of the BO.
4. Components of a Business Object
There are 5 components of a business object:
a. Key Fields
Ø Can be a combination of one or more fields
Ø Is a specification of unique object key - to access a specific instance of a BO
Ø Is a reference to underlying application table
Ø Must be character based
Ø Value set when creating a BO instance or by a method
Ø Can be read from outside. Cannot be changed from outside
Ø Maximum length of concatenated key field can be 70 characters
Ø Properties and characteristics of a BO
Ø Can be read from outside. Cannot be changed from outside
Ø Can be single-line or multi-line
Ø Can be instance independent (static) or instance dependent
Types of attributes:
• Virtual - Set by a method/BO program when accessed
• DB field - Loaded from the database when accessed, based on the key fields
Ø Indicates the occurrence of a status change of a BO
Ø Can have parameters and exceptions like methods
Ø Have listeners outside the BO. E.g. Workflow
Ø These are functions that encapsulates the functionalities of a BO
Ø Can be synchronous or asynchronous
Ø Can be instance independent or instance dependent
Ø Can have parameters (mandatory/optional, single/multi-line, import/export/both) and exceptions
Ø The ABAP implementation can be:
• A function module
• A BAPI
• A transaction
• A dialog module (Obsolete)
• A report
• Other ABAP forms (Direct implementation, ABAP class methods, system program etc.)
Types of methods:
• Synchronous - Result is returned directly to the calling program.
• Asynchronous - Result can be returned to the calling program only through an event.
e. Interface Types
Ø Like models for BO Types
Ø Do not have any key fields
Ø Cannot be instantiated
Ø Do not have development statuses
Ø Can be inherited - substitute for multiple inheritance
Ø Can have implementation
Ø A BO Type can inherit one or more interfaces
Ø Methods defined in an interface can be redefined in a BO Type
Ø The interface IFSAP and its methods ExistenceCheck and Display are inherited by all BO Types by default
5. Business Object Statutes
The following are the different development statuses of a BO/BO Component:
a. Modeled - Only defined (the method and its signature)
b. Implemented - ABAP implementation is done, can be used for testing or internal use
c. Released - Method ready to be used
d. Obsolete - Attribute / Method / Event not to be used anymore
6. Delegating a Business Object
Here we will Discuss how to delegate a Business Object and what is Delegation and why we use it?
Q1>What is Delegation ?
Ans1>Delegation, as the name implies, is a technique of replacing an original object type by its subtype to which additional events/methods may be added.
Q2> Why we use Delegation?
Ans2> If the standard SAP events don't fulfill your purpose, new events/methods may be added to the given object type. SAP doesn't allow changes to its original object types. It permits changes by using the concept of delegation.
Q3>What are the uses of Delegating a BO?
Ans3>By delegating a BO,
àCustomers use their own object extensions with the tasks , events , etc. supplied by SAP.
àWithout having to redefine existing tasks , we can use standard objects with customer extensions.
Transaction to be used-------SWO1 (Business Object Builder)
1)Create a business Object using transaction SWO1.
2)Now take super-type as BUS2012 which you want to delegate.
3)Save it in a 'Z' Package.
4)Click on Object type and go to EDIT. There change the release status of Object type to implement.
5) Again click on Object type and go to EDIT. Now change the release status of Object type to Release.
6)Now click on Methods and press create button. One Pop-up will come and here click on 'No'.
Give the method name and description.
8) After this click on method that you have created. Go to EDIT-Change Release Status.
Here first implement the object type component and then release it.
Here you can notice both tick mark is coming in front of business object and method we have created.
It means method is created successfully.
10) Now in this method , we can write our own code according to our requirement.
In my workflow I have created one method just to add US with DEVHYD.
For this I have created two parameter---ID , USID (under Parameter Tab)
11) Now click On Program tab for writing code in our method.
Here I have written Code for adding US with DEVHYD.
12)Now save and come back. we will come on SWO1 initial screen.
Here under Setting tab click on Delegate.
13) Choose object type as Bus 2012 and click on Details Tab.
14) In Delegation type , write your 'z' object name and then save it.
15) Now we can use it in any TASK. For this go to transaction PFTC.
Write Business object in object type category. Press F4, the method we have created will come.
Now choose that. It means that in BO bus2012 delegation is done.