cancel
Showing results for 
Search instead for 
Did you mean: 

Fire event of Web Dynpro Component Interface

Former Member
0 Kudos

Hi all,

I have a Web Dynpro Component Interface Z_REVISION_CI and a Web Dynpro Component Z_REVISION, which implements the Component Interface. The Component Interface Z_REVISION_CI offers an event CANCEL which should be fired if the cancel button of Component Z_REVISION is pressed. My Main Component Z_MAIN_COMP uses the Component Interface to create Component Usages of Z_REVISION dynamically. If the cancel event is fired, I want to handle this event in my Main Component. I can create a event handler method for the CANCEL event of INTERFACECONTROLLER of Z_REVISION_CI.

The problem is that this method is never called. It seems to me that the FIRE_CANCEL_EVT( ) of the component Z_REVISION is not the correct way to fire an event which is handled by the main component, because the main component has only a usage of Z_REVISION_CI.

Is there a way to handle events of Component Interface, which are fired through the Component?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

I tried it in the same way as you but it does not work. I think the event depends on the Component Usage and thats the problem because I create the Component Usages dynamically.

former_member211591
Contributor
0 Kudos

Hi Christian,

- your component interface Z_REVISION_CI has event CANCEL.

- thus component Z_REVISION, which implements Z_REVISION_CI, has also event CANCEL at its componentcontroller. So you can fire this event out of Z_REVISION.

- your main component Z_MAIN_COMP, which uses your Z_REVISION_CI as a component usage should implement the event handler of the event cancel. (Try to implement event handler within your main component.)

Hope this helps.

ismail

Former Member
0 Kudos

I have tried this, but it does not work! I see the event CANCEL of the Component Interface Z_REVISION_CI and can implement an event handler, but this handler is never called!

The solution I've found in WDR_TESTDYNAMIC is to handle the event dynamically via IF_WD_COMPONENT_USAGE->ADD_EVENT_HANDLER( ).

former_member211591
Contributor
0 Kudos

My implemantation works like this:

1. in my component which is equivalent to your Z_REVISION I can fire the event

(My event is "is_editable_doc" with parameter.) calling the fire-method.

DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).

   lo_componentcontroller->fire_is_editable_doc_evt(
     iv_edit = 'X'                          " wdy_boolean
   ).

2. My interface component (see pic.) just defines the event (it does not handle it! no event handler implemented here), thus my Z_REVISION (which implements my interface second pic) has fire_is_editable_doc_evt in its component controller

3. My main component, which has component usage for the interface component, contains the event handler implementation:


And that works...

Hope this helps..

Former Member
0 Kudos

The Web Dynpro Component WDR_TEST_DYNAMIC does exactly what I need. It has a Usage of the Component Interface WDR_TEST_DYNAMIC_CI which offers the DATA_SELECTED event. There are three Implementations of the Comp. Interface, WDR_TEST_DYNAMIC_1, WDR_TEST_DYNAMIC_2 and WDR_TEST_DYNAMIC_3. The Implementations are firing the event via RAISE_DATA_SELECTED and the Main Component, WDR_TEST_DYNAMIC, is handling this event through HNDL_DATA_SELECTED.

chengalarayulu
Active Contributor
0 Kudos

Hi Christian,

You should define the usage of Z_REVISION component in your main component, because the definition for CANCEL event is there. thereonwards we can call this event like below..

Change the event as Interface enabled after reimplementation of Interface in component Z_REVISION=>events, then fire the event from your main component directly..

if you use dynamic usage also, this will work out..

m_aravindan
Active Participant
0 Kudos

Hi Christian,

                 Check this document , Hope it helps you..

http://scn.sap.com/docs/DOC-35144


Regards

Aravindan