cancel
Showing results for 
Search instead for 
Did you mean: 

Event and event handlers

Former Member
0 Kudos

Hi,

I created an event in Component controller and fired the event in a method of component controller. I caught the event in the View controller and did some coding there(like firing plug). Usage of component controller is already present in the view.

But at runtime, my event is not getting fired in component controller. Can anyone tell me what might be the possible reason for such a behavior.

Regards,

Satheesh Raja.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi , Yes you need to give parameters .You have pass normal ..like i have passed cur_level ,max_level ,cur_element ,node_name .Now these are my exporting parameters in my method call.

In implementation of method .I need to add in parameter table .

When you open any method you come across table Of parameter.

There I add it as

CUR_ELEMENT Importing 1 IF_WD_CONTEXT_ELEMENT

CUR_LEVEL Importing 0 I

MAX_LEVEL Importing 0 I

NODE_NAME Importing 0 STRING

and then my method was able to understand them .

I hope I have shown some direction to you .

Rewards points if really .

Cheers

Parry

Former Member
0 Kudos

Hi Parry,

I'll tell you what I've done. It will give you a better idea.

1.I created a event by name "MODIFY" in the component controller without any parameters.

2. I created a event handler "MODIFY_HANDLER" in the View controller.

3. I fire the event in a method of component controller.

Coding : wd_This->Fire_Modification_Evt( )

4. My event handler code in the View controller is not fired.

Coding : wd_This->Fire_Campaign_Out_Plg( ).

The above plug is not fired. Control never comes here when I debugged.

If you want me to pass the parameter, where I should do it. From the Event to the Event handler? I don't have any context element or node associated here. So I can't have the parameters that you have mentioned.

What I think is, WDEVENT is the importing parameter in the event handler and it is empty since I'm not associating any action with my event. I won't be able to fill this table manually since it is a hashed table. But I need values in WDEVENT to fire some plugs based on the values in it. If there is any way of binding my event with an action, WDEVENT will get filled up and my event handler code will work.

So can you please tell me how can i achieve this behavior.

Regards,

Satheesh Raja.

Former Member
0 Kudos

Hi All,

If I want to Raise the event in a component controller method without any action associated with it, then what should I do. My event handler is in the view.

When I debug, I found out that this event is not raised. Do I need the pass the parameters manually. If yes how?

Regards,

Satheesh Raja.

Former Member
0 Kudos

Hi Satheesh,

Kindly check your event handler code or call in the method.

e.g.

method onactionon_action.

wd_context->set_attribute( name = 'EVENT_ID' value = event_id ).

endmethod.

Or try debugging your code and you will get the exact error.

Cheers,

Darshna.

Former Member
0 Kudos

Hi Satheesh ,

First of all , I will suggest you to add break point at that method and at Event.So you will be able to recognize weather or not control coming upto it .

Other than that this sample code where I have called <b>method</b> create_node from <b>Event</b> ONACTIONON_REC

<b>Action ON_REC</b>

<i>method ONACTIONON_REC .

create_node(

exporting

cur_level = 1

max_level = 1

cur_element = context_element

node_name = 'REC_ORG_UNIT' ).</i>

*******************************************************

<b>method CREATE_NODE</b> .

data:

lr_cur_node type ref to if_wd_context_node,

number type i.

  • create the new node by requesting it as a child node

lr_cur_node = cur_element->get_child_node( node_name ).

  • create its elements

if lr_cur_node->is_supplied( ) = abap_false.

do 5 times.

number = sy-index.

create_element(

exporting

cur_level = cur_level

max_level = max_level

cur_node = lr_cur_node

number = number

node_name = node_name ).

enddo.

endif.

endmethod.

endmethod.

Former Member
0 Kudos

Hi satheesh,

Please see if you are using the right attribute. All i mean to say is for try with wd_comp_controller instead of wd_context.

regards,

abhishek