|Home • Trainings • Quiz • Tips • Tutorials • Functional • Cert Q's • Interview Q's • Jobs • Testimonials • Advertise • Contact Us|
Working with Business Objects in SAP
By Swetabh Shukla, Infosys
Business Object type contains methods,
attributes and events which give a component based view of any Business Process.
For example we have a Purchase Order
business process. This process includes various small functionalities. It will
have process of changing Purchase orders based upon requirements, functionality
to retrieve the details of purchase order etc. Each of these functionalities is
encapsulated inside a method. The method can call the function modules present
in R3 system or can have there own code to execute some functionality. So if we
consider Purchase Order as a Business Object then it will be identified by key
field Purchase Order number. Each purchase order business object based upon key
field purchase order number is different. It’s so because each purchase order
is different and will contain different details.
So the methods contain business
functionality. Attributes are just like properties of the Business object.
For example for any purchase order Purchasing Group, Purchasing
Organization etc are attributes.
Technically we can say that business
object types are just like any template. At runtime we instantiate or create
runtime objects for any BO (Business Object) type based upon the key fields we
pass. Two runtime Business objects of same BO type are different from each other
based upon the key fields we pass. So the key field is the differentiating
factor for two or more runtime business objects of same BO type.
To Browse for BO open tcode SWO2 (Path
-> Tools ->ABAP Workbench->Overview->Business Object Browser).
You can expand the nodes and can check
various business objects in BOR. You can double click on the BO node and it will
take you to BO display (SWO1).
Working with Business Object in our programs
For creating a Business Object and its attributes there are many already existing tutorials. So in this tutorial we will not discuss creation of BO and its attributes.
To create instance of a BO
To create an instance of BO we need to
have the key fields of that BO. Key fields will be used to uniquely identify the
BO. We can use the FM 'SWO_CREATE' to create an instance of BO in any report
The other way is to use the macros
defined in include <cntn01>
the macro calls the FM SWO_CREATE. So you can either go for direct FM call or
the macro call.
Basically the term Container is used
with reference to Business Objects and Workflows. The Container actually holds
import and export parameters associated with any method of Business Object at
runtime. When ever we are calling any method of Business Object we need to
populate container for import parameters and after the method gets executed it
returns the values (export parameters) in Container.
Business Object container is technically
of type SWCONT structure.
Here ‘ELEMENT’ will be name of the
variable/internal table which container holds and ‘VALUE’ will have
corresponding value. For multi line variable or internal tables, the container
will hold multiple values with same element name.
Lets take an example to check what Container is
For example let’s create a Business
Object ‘ZSWE1’ with only one method ‘READ’. We will discuss the creation
of BO in very brief.
Key field will be Purchase Order number
(EKKO_EBELN) for BO.
Method READ will take Purchase Order
number as input and will give all the Purchase Line items in it in an internal
1 : Create BO ZSWE1 for test purpose. You can give it any name.
2 : Now create a method READ
Save the method. Now we will create the
parameters of the method.
PurchasingDocument will be a import parameter of type EKKO_EBELN.
ITEM will be a export parameter of type
EKKO_EBELP and will be a multi line variable(internal table )
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM
©2006-2007 SAPTechnical.COM. All rights reserved.
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG.
Graphic Design by Round the Bend Wizards