Generic Object Services (GOS) Toolbar Part 3 : Add toolbar in Custom Program

By | February 2, 2009 | Generic Object Services (GOS) | 30,001 | 16

Shows the code for how to add Generic Object service Toolbar in the Z program

You can find all of these discussions at Tutorials > Generic Object Services (GOS).

Today, we will see how to get the GOS toolbar in the custom Report.

GOS toolbar works on the Business Object. To be able get GOS toolbar, we need to have a Business Object and Business Object Key. For example, to get the GOS toolbar for the customer, we need Business object KNA1 and customer number as the key. So, if we want to have a GOS toolbar in our custom transaction than we need to have a key before generating that. This is the reason; we don’t have the GOS toolbar option in the standard SAP Create transactions like: XD01, VA01, MM01 and so on.

This test program will provide us the GOS toolbar for the Customer in our custom program (Z program). This will provide us all the functionality of the GOS toolbar which are available in the XD02, XD03 transaction.

Code Snippet to Add GOS toolbar to Custom program

*&---------------------------------------------------------------------*
*& Report  ZTEST_NP_GOS
*&
*& To Generate GOS toolbar in the Custom Transaction
*&---------------------------------------------------------------------*
*
REPORT  ztest_np_gos.
*
DATAlo_manager  TYPE REF TO cl_gos_manager,
      la_obj      TYPE borident.
*
PARAMETERSp_kunnr TYPE kna1-kunnr.
*
*
START-OF-SELECTION.
*
* Set object Key
  la_obj-objtype 'KNA1'.
  la_obj-objkey  p_kunnr.
*
* GOS toolbar
  CREATE OBJECT lo_manager
    EXPORTING
      is_object    la_obj
      ip_no_commit space
    EXCEPTIONS
      OTHERS       1.
*
* To generate output
  WRITE'GOS test for Customer'.

Now, we will get the GOS toolbar which will look like this:

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{274 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 274 articles.

Load comments

16 Comments

  • Anonymous

    Do we need to any configuration along with this code (update tables).

    I am getting the GOS toolbar. But when I slect CREATE all the options are greyed out.

    Thanks

  • “I am getting the GOS toolbar. But when I slect CREATE all the options are greyed out.”

    For which business object, you are trying to get a GOS toolbar?

    Regards,
    Naimesh Patel

  • Anonymous

    We have Z object. It is a table. I don’t see that object in “Swo1” but there is table with that z name. This is part of production support.

    Do i need to check any config table???

    Thanks

  • Anonymous

    Naimesh,

    Can you please suggest not above issue?

    Do i need to check any config table???

    Thanks

  • JAJ

    Hi Naimesh, was a very good one, but I tried adding a doc to a notification number . when I open the IW53 , i am not able to see the added document. Please suggest what has to be done more.

  • You must need a business object created in the SWO1 to be able to store the documents.

    If you see closely the above example, it uses the standard business object for the customer. Same way, you need to have the business object for your requirement.

    Regards,
    Naimesh Patel

  • Hi,

    Service for object functionality is grayed out for the dispute management. I am not able to add documents to the cases.

    Not sure how can i turn it on.

    Any help is much appreciated.

  • Hello SAP-Toronto,

    Service for object functionality is grayed out for the dispute management. I am not able to add documents to the cases.Can you provide the Transaction you are using?

    Regards,
    Naimesh Patel

  • Marina Vaizman

    Hello Naimesh.

    I am working on ECC 6 and have a problem with VA03 txn. GOS toolbar doesn't appear and when I am trying to get it through the menu there is message 'No services available'.
    In the meanwhile everything works correctly with ME23N for example.
    I see that you are good expert in this topic, may be you could help?

    Thank you in advance, Marina.

  • I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

    Susan

    http://8080proxy.com

  • Anonymous

    Hello,

    Our 'create attachment' icon is greyed out in fbd3. It works fine for everything else. Any suggestions?

  • RAV

    Hi There Naimesh

    We would like to grey out the create attachement option, as it stores to the SAP Db and we do not want the users to use that. We have already setup the 'store business document' that we want the users to use.

    How can we grey 'create attachment' out?

    Thanks alot!

  • your post is nice . . let me tell u one thing that Blogs have become latest and important source of quality free information on net people enjoying for hours together. . .nice blog keep sharing;)
    Dissertation Writing Services

  • Hi Naimesh,

    Nice blog and appreciate your efforts in explaining from every corner. My requirement is to attach the GOS toolbar and its functions to a custom WD screen. Is there any SAP delivered component throuh which we could achive it? Instead of accessing through the CL_GOS* classes. please shootout any other thoughts if you see..

  • I want to restrict user to delete attachment file.

  • Naimesh Patel

    Hello Ankit,

    SAP has a authority object S_GOS_ATT. You can use this to control the User’s authorization. Check this SAP Knowledge Base Article Authorization concept while modify/delete attachments from Attachment list of Services for Object (GOS) for more information.

    This object check is available as part of different Support Pack based on your system version. Check OSS Note: 1293080 for more info.

    Regards,
    Naimesh Patel

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.