Activating Generic Object Services Toolbar in SAP Objects

作者:郑德鼎 约 6 分钟阅读 更新日期:2024-02-22 2 年前更新 标签:ABAP, Data Engineering, MM, SD, 工具, 开发, 技术, 数据工程, 物料管理, 销售分销
目录

Abhijeet Kapgate

Posted onNovember 21, 2012 5 minute read

Activating Generic Object Services Toolbar in SAP Objects

FollowRSS feedLike

66 Likes 139,559 Views 88 Comments

Business Requirement

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)

Telephony

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

EXPORTING

IS_OBJECT = LS_BORIDENT

IP_NO_COMMIT = ‘ ‘

EXCEPTIONS

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.

Example

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.

Some transactions where GOS is activated using this class.

Alert Moderator

Assigned tags

ABAP Extensibility

abap

activating gos

enhancements

gos

View more...

Related Blog Posts

How to implement GOS for standard transaction VA01/VA02/VA03

By Former Member, Mar 02, 2017

Object still in upgrade mode. Finish the upgrade first

By Former Member, Sep 26, 2016

Part I: Custom Business Object – UI (Bonus Plan)

By Ulrike Liebherr, Jan 20, 2017

Related Questions

Activating Generic Object services for certain SAP objects

By Former Member, Jun 12, 2012

Service for Object button is not available when program is called by RFC

By Marcin Czarny, Sep 07, 2016

Customizing object services toolbar

By Former Member, Aug 26, 2008

88 Comments

Kapil Changrani

November 22, 2012 at 7:36 am

Concise and Informative.

Like(0)

Reply

Alert Moderator

Former Member

November 22, 2012 at 9:33 am

Nice Document....Thanks

Like(0)

Reply

Alert Moderator

Ashutosh Mishra

December 21, 2012 at 11:05 am

Hi,

I am not able to write the code that you provide in above part in enhancement include "LCSDIFCD" for CS01/CS02/CS03.

Please explain me how i will resolve this Issue.

Thanks

Like(0)

Reply

Alert Moderator

Abhijeet Kapgate Post author

December 21, 2012 at 11:17 am

Hi Ashutosh,

You will have to create implicit enhancement to write the code.

Like(0)

Reply

Alert Moderator

Ashutosh Mishra

December 21, 2012 at 11:06 am

Helpful answer

Like(0)

Reply

Alert Moderator

Ashutosh Mishra

December 21, 2012 at 1:14 pm

Hi Abhijeet,

Thanks for Quick response!!! can you tell how i ll get the value as a dynamic in Object Key.

Like(0)

Reply

Alert Moderator

Abhijeet Kapgate Post author

December 21, 2012 at 1:34 pm

Hi Ashutosh,

If I understand your query correctly, the business object will always be known as to which SAP object needs to be enhanced to have the GOS toolbar and will not be dynamic.For e.g. you will have clear requirement to enhance this particular transaction.Whereas the object key will always be dynamic and its values will be obtained in the standard structures (table,workareas) which get filled run-time inside the includes where you write the code.

Hope this helps.

Thanks.

Like(0)

Reply

Alert Moderator

Ashutosh Mishra

December 21, 2012 at 1:40 pm

Hi Abhijeet,

After doing the Implicit enhancement i did the code in below format then its working for all the material,Plant and BOM Usage.

DATA: LR_GOS_MANAGER TYPE REF TO CL_GOS_MANAGER,

IS_BORIDENT TYPE BORIDENT.

data : l_objky(23) type c.

CONCATENATE POMAT-matnr POMARC-werks RC29N-STLAN INTO l_objky.

IS_BORIDENT-OBJTYPE = 'BUS1082'.

IS_BORIDENT-OBJKEY  = l_objky.

CREATE OBJECT LR_GOS_MANAGER

EXPORTING

IS_OBJECT = IS_BORIDENT

IP_NO_COMMIT = ' '

EXCEPTIONS

OBJECT_INVALID = 1.

Thanks a lot for your Document.

Like(0)

Reply

Alert Moderator

Ashutosh Mishra

December 27, 2012 at 10:19 am

Hi all,

If you want to activate Store Business Document then you have to pass the objtype as "BUS1080" in place of "BUS1082" in the above code.

Like(0)

Reply

Alert Moderator

Former Member

June 13, 2013 at 9:26 am

Nice and Informative!.. Good One .Useful.

Like(0)

Reply

Alert Moderator

Aditya Bajoria

July 10, 2013 at 8:23 am

Nice document.

I have a requirement to add this toolbar at budgeting trasnactions such as CJ30-CJ38 etc.

Any help??

Like(0)

Reply

Alert Moderator

Abhijeet Kapgate Post author

July 10, 2013 at 11:31 am

Hi Aditya,

Thank you for your query. You can achieve the requirement by following the above post.

If you debug, you will get an include in the PBO for CJ30 where you can add this piece of code thru implicit enhancement.

The include name is - MKBUDF02

Form name - INIT_PROJ_PBO

Click on the 'Enhance' button (Shift + F4). Go to Menu->Edit->Enhancement Operations->Show implicit enhancement options.

A dotted line will appear. Right click->Enhancement implementation->Create

Then write following code

DATA: LR_GOS_MANAGER TYPE REF TO CL_GOS_MANAGER,

LS_BORIDENT TYPE BORIDENT.

LS_BORIDENT-OBJTYPE = 'BUS2001'.

CREATE OBJECT LR_GOS_MANAGER

EXPORTING

IS_OBJECT = LS_BORIDENT

IP_NO_COMMIT = ' '

EXCEPTIONS

OBJECT_INVALID = 1.

...

郑德鼎

关于作者:郑德鼎

企业信息化与 SAP 技术顾问,长期专注 SAP ABAP、FI/CO、MM、SD 等模块的技术分享与实战经验总结。查看更多介绍

来源说明:本文内容由「Activating Generic Object Services Toolbar in SAP Objects.docx」整理生成,仅用于内部技术分享与学习交流。