Activating Generic Object Services Toolbar in SAP Objects
Many a times there is a business requirement of linking documents, entering notes, sending notes or linking an internet address to various SAP objects. These external attachments can be reference documents, pictures, Email attachments, designs, diagrams or related spreadsheets. To meet this requirement SAP has provided a tool bar called ‘Generic Object services toolbar’ or ‘GOS toolbar’.
What is GOS
The GOS is a toolbar that provides different functions such as adding an attachment, creating a document link, displaying all the attachments etc. The attachments are not generic for that transaction but are specific for a particular SAP object. The GOS toolbar can be activated using a class CL_GOS_MANAGER.
Currently in the system the GOS toolbar is available by default only for certain SAP objects.
For Ex. ME21N. See screen shot below. The GOS toolbar is highlighted.
As shown above, the attachments created in ME21N screen will be linked to a particular purchase order and cannot be seen for any other purchase order in ME22N or ME23N screens.
Services that the GOS toolbar provides
The following list shows all possible object services. Not all object services are available – it depends on objects that are already active. Individual object services can also only be accessed using a sub-menu, so that the symbol is not displayed in the toolbox.
- Adding an attachment
- Entering a Note with an Object
- Sending an Object with a Note
- Starting a Workflow for an Object
- Linking an Internet Address
- Entering a Bar Code
- Tracing Events for the Object (Subscription)
- Displaying Object History
- Displaying Workflows for the Object
- Displaying Transmissions for an Object
- Displaying Relationships
- Displaying Attachments
Activating Generic Object Services toolbar
The Class CL_GOS_MANAGER is used for activating the GOS toolbar. We have to create an instance of the class. The instance of the class can be created by calling the constructor method. Also, a variable of type BORIDENT needs to be created for the application business object. The object type and object key is assigned to this variable which is then passed to the instance of the class CL_GOS_MANAGER as shown below. This entire code has to be written either inside a suitable user-exit, enhancement point. If both user-exit and enhancement point are not applicable, implicit enhancement can be created inside the standard of that transaction where GOS has to be activated.
The syntax is:
DATA: LR_GOS_MANAGER TYPE REF TO CL_GOS_MANAGER,
LS_BORIDENT TYPE BORIDENT.
LS_BORIDENT-OBJTYPE = ‘BUS2081’.
LS_BORIDENT-OBJKEY = ‘12345678902011’.
CREATE OBJECT LR_GOS_MANAGER
IS_OBJECT = LS_BORIDENT
IP_NO_COMMIT = ‘ ‘
OBJECT_INVALID = 1.
Here the object key is the combination of the SAP fields that are mandatorily required to execute those transactions. This will publish the GOS with the supplied BO instance if it is used in an executable program.
Earlier the Function Module SWU_OBJECT_PUBLISH was used for activating the GOS toolbar which now has become obsolete. The object type and the object key were passed as the import parameters to the function module.
For the material BOM transactions (CS01, CS02, CS03), the GOS tool bar is not provided by standard SAP. See screen shot below.
We will see below how we can activate the GOS toolbar using above class for transactions CS01 / CS02 / CS03.
To activate it we need to do an enhancement in include ‘LCSDIFCD’ inside form OKCODE_BEARBEITEN. For transaction ‘CS03’ material number, plant, BOM usage are the required fields. See screen shot below:
- So the object key for above example is combination of values of material number, plant and BOM usage.
How to get the object key
The object key can be found out from the object type. Enter the object type in transaction ‘SWO1’
Click on display.
E.g. If material number is 100000000000000099,
plant is – 1234 and
BOM usage – 5, the object key will be
Object-key = ‘10000000000000009912345’
2. The object type can be found in table TOBJ and also from transaction SWO1.The object type for Material BOM (CS01/02/03) – BUS1082.
3. Leave the IP_NO_COMMIT parameter as blank.
If the parameter IP_NO_COMMIT is set, it means that your application should start ‘COMMIT WORK’ command. That is also the default value.
If the parameter is empty, the object services will call the ‘COMMIT WORK’. In this case, the data passed should be consistent.
When called because the database changes cannot be reversed using ‘ROLLBACK’.
4. The GOS toolbar / Button will now be visible and activated in t-codes CS01, CS02 and CS03 after the enhancement is activated.
5. For Sales order, the service can be activated by setting user parameter.Set parameter SD_SWU_ACTIVE = ‘X’ in the user profile. This will activate the
generic object services for VA01, VA02 and VA03.
Steps to create attachments for a Material BOM
1] Click on the GOS toolbar. Different options will be displayed.
2. Click on ‘Create-> Create attachment’ option.
3. A pop-up window will be opened to find a file or attachment as shown below.
Select the file and click on open.
4. A success message will be displayed in the task bar.
5. Now let us create an external document link. Follow the screen shot below:
6. Click on Enter.
A success message will be displayed at the status bar ‘The attachment was successfully created’.
Viewing the attachments
1] To view the list of attachments, go to attachment list as shown below.
2] The list will be displayed as shown below.