1 - Activating generic business object services (GOS)
If you want to have the same functionality that is available when you push the Services for Object button located at the top of each SAP related document you can do the following:
1) Enable your functionality as an object in the BOR using SWO1 - Make sure it generates2) Add this code to your EDIT dialog (in the PAI section after pushing a button) that you use against that object.
*** EXAMPLE CODE ***
data l_borident like borident.
CASE ok_code.
WHEN 'OBJSERV'.
l_borident-objkey = zcustomobj-id.
l_borident-objtype = 'ZCUSTOM'.
l_borident-logsys = 'DEVCLNT005'.
IF NOT l_borident-objtype IS INITIAL and
not l_borident-objkey is initial.
CALL FUNCTION 'SWU_OBJECT_REFRESH'.
** activate generic system service
CALL FUNCTION 'SWU_OBJECT_PUBLISH'EXPORTING
objtype = l_borident-objtype
objkey = l_borident-objkey
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
CALL FUNCTION 'SWU_OBJECT_DISPATCH_SERVICE'
EXPORTING
service = 'HC1H'
called_by_system = space
EXCEPTIONS
OTHERS = 0.
ENDIF.
ENDCASE.







