Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to assign the events in a specific method in class builder(se24)

Former Member
0 Kudos

i have declared one event in event part.i want to asign the event to one method .can any one help me .i have to do it in se24.pls

2 REPLIES 2

uwe_schieferstein
Active Contributor
0 Kudos

Hello Niranjan

Assuming that you have defined an event MY_EVENT in your class you can define within the same class an event handler method, e.g. HANDLE_MY_EVENT. In order to do so go to the Properties tab when creating the method and mark checkbox "Eventhandler for". Enter your class and the event (e.g. MY_EVENT).

Finally, you have register the event handler method, e.g. in the CONSTRUCTOR:

  SET HANDLER handle_my_event FOR me.

To raise the event you need the following coding in one of your class methods:

  RAISE EVENT my_event.

For comparison, have a look at class <b>CL_GUI_ALV_GRID</b>. The instance method <b>CHECK_DATA_CHANGED</b> raises <b>event DATA_CHANGED</b> if values on an editable ALV grid have been changed. The method is usually called at PAI of the dynpro displaying the ALV grid.

Regards

Uwe

Regards

Uwe

Former Member
0 Kudos

hi,

create a class in se24.

<b>click the <b>EVENTS</b> tab, define an event.</b>

<b>click the <b>METHODS</b> tab, define a method to trigger/ raise the event</b>

<b>define one more method as an event handler method for the event.</b>

for a method to be an event handler, click on the detail view,

select the check box <b>Event Handler for</b> give the classname where the event is defined and the event name, click on Change button.

<b>event can be in the same class or different from that of the event handler method.</b>

don't forget to <b>register the event handler method in the program.</b>

click the code button of ur trigger method(meth2 in my example) and write there,

raise event evt1.

now your class is ready.

now in se38 program,

declare a reference variable to ur class,

create an object,set the handler for ur event,

call the trigger method

<b>data:oref type ref to zsowcl1.

create object oref.

set handler oref->meth1 for oref. handler method

call method oref->meth2. raise evnt method</b>

hope it gives you clear idea,

Regards,

Message was edited by:

sowjanya s