cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic registration for a component event

Former Member
0 Kudos

I have done a dynamic registation of a sub-component event in my WebDynpro component. The event is fired in the sub-component. But my event-handler method is not called.

Has anybody any hints, what i could have made wrong?

Code-Extracts:

In my sub-component:

METHOD onactionexit_dialog .

wd_comp_controller->Fire_exit_event_Evt( ).

ENDMETHOD.

In my main component

METHOD onactionmenu_click .

DATA:

lr_cmp_usage TYPE REF TO if_wd_component_usage

lr_api TYPE REF TO if_wd_view_controller,

....

lr_cmp_usage = wd_this->wd_cpuse_dialog( ).

lr_api = wd_this->wd_get_api( ).

lr_cmp_usage->create_component( component_name = ls_wdcomp-component_name ).

lr_cmp_usage->add_event_handler(

listener = lr_api

handler_name = 'END_DIALOG'

controller_name = 'INTERFACECONTROLLER'

event_name = 'EXIT_EVENT' ).

...

ENDMETHOD.

Furthermore the Method END_DIALOG is defined as event handler method in the corresponding view controller

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

thank your very much Rahul for your support.

I tried several things today. When I embed the sub-component statically and register the event dynamically it works, like you said !

But my case is more complicated. I create the sub-component dynamically and register the event dynamically. This does not work, I can do what I want.

I put the two components in one program, one sub-componeent embedded statically the other dynamically. I debugged the object CL_WDR_COMPONENT_USAGE for both cases. The attribute EVENT_SUBSCRIPTIONS had the same content for both cases. But the event of statically embedded component reached my method, the one of the dynamically embedded component not.

Former Member
0 Kudos

Your suggestion, i have tried as well. I registered the event in the componentcontroller, but this didn't wiork either

Former Member
0 Kudos

Hi,

Well, it is working absolutely fine for me. Double check with the name of event handler.

Thanks,

Rahul

Former Member
0 Kudos

Thank you Rahul for your answer,

your recommendations make sense, because point 1. I had forgotten first, but I have found out by myself, before I have posted this problem

1. Event is marked as interface event in sub component

2. You have declared the usage of interfacecontroller in the properties tab of view controller

So: Yes, I did these two things, but nevertheless it does not work.

Former Member
0 Kudos

Hi,

If it is still not working then i would ask you to try with event handler in componentcontroller and do the registration over there.

Thanks,

Rahul

Former Member
0 Kudos

Hi,

From code it seems that everything is fine but still please check few things.

1. Event is marked as interface event in sub component

2. You have declared the usage of interfacecontroller in the properties tab of view controller

If still, it doesn't workout then i would suggest you to write your eventhandler in componentcontroller and try to register there only.

Thanks,

Rahul