Login Form

Best viewed in IE 7.0

ADVERTISEMENTS
ADVERTISEMENT

Generic Object Services (GOS) Toolbar - Handle added Service in the Toolbar

Original article posted on http://help-abap.zevolving.com.

As discussed in the post Generic Object Services (GOS) Toolbar Part 1 : Add New Option in the Toolbar, today we will see how to call our custom business logic in the added new Service in GOS Toolbar. To be able to process custom logic in the GOS toolbar service, we need to inherit out service class from the GOS generic service class CL_GOS_SERVICE and put our logic in the inherited class.

Steps to follow:
1. Inherit a class from the CL_GOS_SERVICE:


2. Maintain the Entry in the Table SGOSATTR as discussed in the Generic Object Services (GOS) Toolbar Part 1 : Add New Option in the Toolbar:


3. Redefine the Method EXECUTE to process our custom business logic. Redefine the Method and activate it. For demo purpose, we will not implement any logic in this but you can create a ALV or kind of list as we get in the Attachment List.


Now, when we access the GOS toolbar, you will see the option “Sales Order List”.


By accessing this option, you will get the empty screen like this:


You may have noticed that this Option is coming in all the GOS toolbars i.e. Toolbar in XD02 and XK02 and so on. To restrict the GOS toolbar service to only particular transaction, we need to redefine the method CHECK_STATUS.


Code snippet for the CHECK_STATUS method:

Code Snippet to Redefine CHECK_STATUS
 
*&---------------------------------------------------------------------*
*& Redefinition of the Method CHECK_STATUS
*&---------------------------------------------------------------------*
METHOD CHECK_STATUS.
* Service active for customer
  IF IS_LPORB-TYPEID = 'KNA1'.
EP_STATUS = MP_STATUS_ACTIVE.
ELSE.
EP_STATUS = MP_STATUS_INVISIBLE.
ENDIF.
*
ENDMETHOD.
Now, we will only get the service only in the XD02 and XD03 transactions.
ADVERTISEMENT
Free software downloads