Create Business Object in SAP
ABAP programmers can create business object in SAP system using SWO1 transaction code.
I used Business Object to attach image and document files in Web Dynpro component development for a custom application header data.
As an important part of file upload and display on SAP Web Dynpro tutorial, before using GOS Service cl_fitv_gos class the business object should be created.
I tried to share how to create business object step by step in this ABAP tutorial.
Create Business Object using SWO1 Business Object Builder
Call SAP transaction code SWO1. SWO1 will display the initial screen for Business Object Builder.
Enter the name of the Object type you want to create in the "Object/Interface Type" input text field.
Make sure that the Category is selected as "Object type"
Then press Create button.
Provide the object type properties and attributes like name, description, program, application, etc.
All these defined values are new and will be created in the end of this process except the Application information.
Since my target business object is related with sales processes, I chosed V as Application value.
After you press OK or press Enter, SAP users will be displayed with below screenshot where the details of the business object type are shown.
To define the key fields which are used to define uniqueness of a business object, click on "Key fields" line.
Then press Create (F5) button from menu.
A wizard screen will let you copy the key fields from an ABAP dictionary object. Press Yes to make the key field selection simplier.
Since my business objects are records from a ABAP transaction table where the header data of the custom proforma process is kept, I entered the table name and press Enter.
Key fields defined on the ABAP table will be listed on the screen.
Select the fields by highlighting the rows. After you select all the fields that you want to define as key fields of your new business object, press Enter.
Please note that, it is possible to select more than one key field for your business object if your ABAP table has.
A summary information will be displayed after your selection. Press Create icon to continue.
You will see the key field is listed under the Key fields of new object type on "Change Object Type" ABAP screen.
Before you generate the business object, from top menu follow menu selections:
Edit > Change Release Status > Object Type > To implemented
Now you can generate the business object type.
We have successfully created our Z_PROFORMA custom business object type.
Test Business Object using SAP transaction OAOR Business Document Navigator
Call SAP transaction OAOR, Business Document Navigator.
Enter the class name as the one you have just created in above steps and class type as "BO", then press Enter..
The following screen will request from the user the key field values of the business object.
Enter the appropriate value.
SAP user will successfully reach the Business Document Navigator.
Using Create document icon, users can attach documents like MS Office documents, text files or images, etc to this business object.
It is also possible to attach files to business objects using the GOS service cl_fitv_gos class automatically by ABAP code.