Business Object in SAP Business Workflow is defined as a collection of methods or events for an entity in business process. Few common Business Objects in SAP system include: Customer, Material, and Vendor. With the use of Business Objects, all services are provided in the form of executable methods.
An object in the Workflow represents a Business entity in SAP system. Common entity example includes: Purchase Order, Material, Vendor, etc.
An Object in SAP system performs the following functions −
A Business Object reduces the complexity of SAP system by dividing it in small units.
With the use of Business Objects, different components in SAP system can communicate with each other.
Business Objects can be used in RFCs and Workflows.
With the use of BAPI’s and Business Objects, SAP system can communicate with non-SAP system.
Each Business Object in SAP system contains the following five components −
Key Fields
Specification of a unique object key - to access a specific instance of a BO
Key field is represented as a combination of one or more fields
Shows a reference to underlying application table
Character based
You can read a Business Object from other non-SAP system
You can’t change a Business Object from outside
Maximum length of concatenated key field can be 70 characters
Attribute
Two types of attributes - Virtual (Set by a BO program) and DB Field (Loaded by database)
An attribute can be read from out of SAP system but it can’t be changed
An attribute of a BO shows properties and characteristics of the object
An attribute can be shown as one line or multi-line
You can have an attribute which is instance independent or instance dependent
Events
Events contain listener outside the BO like SAP Workflow
It is used to trigger or terminate a SAP Workflow
It also shows change in occurrence of a Business Object
Methods
Method can be of two types - synchronous (result is returned to calling program) and asynchronous (result can be returned to calling program using an event)
Method can be instance dependent or instance independent
Method consists of exceptions and parameters such as single/multiline, optional/mandatory, etc.
Interface Types
A Business Object in SAP system can inherit one or more interfaces
You can have methods defined in an interface that can be redefined in Business Object type in the Workflow
A BO in development can have different development statuses −
Modeled − This status shows a BO as only defined - i.e. method and its signature
Implemented − This status shows that ABAP implementation is done and you can use BO for testing purposes
Released − This shows that the method is ready to use
Obsolete − This shows that the method/event shouldn’t be used anymore
Step 1 − To create a Business Object, use the Business Object Builder (T-Code − SWO1). The following screenshot pops up.
Step 2 − Click Create. The following window opens. Define the object Supertype.
Step 3 − Fill in all the other details. Select the application from the search list as shown in the following screenshot.
Step 4 − Next, save the package. Save package in “Z” package as shown in the following screenshot.
Step 5 − To change the release status of object type, go to Edit → Change Release Status → Object Type → To Implemented.
Step 6 − Click the Object type and go to Edit. Again to change the release status, go to Change Release Status → Object Type → To released.
Step 7 − In the following window, click Methods → Create button. A pop-up will open, select 'No'. Pass the method name and description as in the following screenshot and click the Tick button.
Step 8 − Now, select the method created. Go to Edit → Change Release Status. Here, first implement the object type component and then release it.
Step 9 − Note that a tick mark in front of the method and BO shows that it is created successfully. Add parameters to the method by clicking the Create button.
Step 10 − Navigate to “Program” tab for adding code to the method as shown in the following screenshot. Click the Save button to save a created object.
You can also delegate this object to its subtype. Delegation is used to replace an original Business Object by its subtype to which you can add additional events/methods.
To delegate a Business Object, navigate to SWO1 T-code. Setting → Delegate as shown in the following screenshot.