Skip to Content
Technical Articles
Author's profile photo Hyung Jin Youn

How to enhance SAP GOS Generic Object Services, SGOSATTR & SGOSCUST

Business requirement 

I had a chance to enhance GOS email service from my suggestion to utilize already activated GOS functionality instead of building new object.

GOS has been activated at lots of SAP transactions in my system but only specific Tcode needs to be enhanced. The enhancement point of the requirement was “Send” email -> “Send Object with Note” at VIM DP document transaction.









Searching the node of GOS at SGOSATTR. 

SO_SENDOBJ is a sub node of SO_SENDSERV. So need to replace the ABAP class CL_GOS_SRV_SEND_OBJECT with a custom class


Assign a custom class in Table SGOSCUST

Create a custom class inherited from the standard class CL_GOS_SRV_SEND_OBJECT or from the super class CL_GOS_SERVICE of CL_GOS_SRV_SEND_OBJECT.

Redefine Method ‘EXECUTE’ of CL_GOS_SERVICE at newly created customer class which is  assigned to above img table.

In my case, I choose the BOR object with a global variable gs_lporbtypeid .

Example : “BUS2012” Purchase Order

gs_lporb has field INSTID -> Document number, TYPEID -> BOR name, CATID  -> BO “BO” indicator. So only specific BOR will call my enhancement otherwise call Standard logics   super->execute( ) .


Build custom logics 

Custom default subject & message, “Confidential Clause” are added as part of enhancement for my case.

      lt_text     TYPE soli_tab,
      lp_subject  TYPE so_obj_des,
      lp_line     TYPE soli,
      lp_oid      TYPE os_guid,
      ls_object   TYPE borident,
      lp_mess(80) TYPE c,
      lp_errmess  TYPE string.

* Set object info for link
        ls_object-objtype =  gs_lporb-typeid.
        ls_object-objkey  =  gs_lporb-instid.

* Set mail subject
        lp_subject = TEXT-101 && gp_def_attrib.

* Add confidential Clause
        DO 6 TIMES.
          APPEND  INITIAL LINE TO lt_text.
        DATA(lv_cc) = cl_wd_utilities=>get_otr_text_by_alias( 
                      zif_vim_email_service~gc_confidential_clause ).
        lt_text = CORRESPONDING #( BASE ( lt_text ) cl_bcs_convert=>string_to_soli( lv_cc ) ).

* Customer enhancement for VIM
        lp_oid = me->send_obj(
                    is_object             = ls_object
                    ip_subject            = lp_subject
                    it_note               = lt_text
                    ip_link               = 'X'

        lp_errmess = lp_mess.
        MESSAGE lp_errmess TYPE 'S'.
        IF lp_oid IS INITIAL.
          RAISE execution_failed.
          MESSAGE s051(sgos_msg).
          RAISE EVENT service_succeeded
            EXPORTING eo_service = me.
      CATCH cx_bcs.
        RAISE execution_failed.


Unit Test 

Default subject, pre-defined message and default recipients populated by the enhancement


and invoice document is being attached as PDF file which is not supported by SAP standard





You can add custom functions with SAP standard GOS (Generic Object Service)s features like adding notes, workflow tasks,  and sending emails using this simple enhancement.

For instance, posting Twitter articles or social media massages, read/write documents from external servers, API call from external service providers, and etc.


Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.