Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SetHandler

Can anybody explain in detail about the importance of the keyword 'Set Handler' with the SYNTAX OF SETHANDLER keyword particularly in case of 'STATIC EVENT' and in caes of an 'INSTANCE EVENT'.

Former Member
Former Member replied

Hello Sandeep

Irrespective of the level of the event (static vs. instance) the meaning of the statement

SET HANDLER is as following:

If you want to react on an event raised by a class you <b>must </b>to define an event handler. For example, if you want to react on the event DOUBLE_CLICK in an ALV list (instance: go_grid) you need to define an event handler method (e.g. static method handle_double_click of event handler class lcl_eventhandler) and register it:

SET HANDLER:
   lcl_eventhandler=>handle_double_click FOR go_grid.

Alternatively, if the event handler method should handle the event for all grid instances you can use:

SET HANDLER lcl_eventhandler=>handle_double_click FOR ALL INSTANCES.

By default, the event handler is set active:

SET HANDLER:
   lcl_eventhandler=>handle_double_click FOR go_grid.

" ... is identical to:

SET HANDLER:
   lcl_eventhandler=>handle_double_click FOR go_grid ACTIVATION 'X'.

If you want to inactivate an event handler then code:

SET HANDLER:
   lcl_eventhandler=>handle_double_click FOR go_grid ACTIVATION ' '.

Regards

Uwe

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question