Skip to Content

STEP 1. Create a web dynpro component .

/wp-content/uploads/2013/01/step1_175047.png

2.Go to view and create a text view and a button.

step 2.png

3. Create a action for the button.

/wp-content/uploads/2013/01/step3_175088.png

4.After clicking on OK button, the method will be created .

/wp-content/uploads/2013/01/step4_175090.png

5.now go to component controller and go to events tab.

/wp-content/uploads/2013/01/step5_175091.png

6.Give an event name and tick the check box Interface.

/wp-content/uploads/2013/01/step6_175092.png

7. Now go to view and to the Action of the Button.

/wp-content/uploads/2013/01/step7_175093.png

And go in to the click method of the button.

Just raise the event which we declared in the component controller.

/wp-content/uploads/2013/01/step8_175094.png

Source code :


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

lo_componentcontroller->fire_e1_evt(
).

The concept is , whenever the button is clicked the event e1 will be raised.

8. Now save and activate the component.

/wp-content/uploads/2013/01/step9_175095.png

10. Now create another component as shown below.

/wp-content/uploads/2013/01/step10_175096.png

11.In used web dynpro components , use the previous component that we have created .. as shown.

/wp-content/uploads/2013/01/step11_175100.png

So that the 1st component can be used …

12.Now go to view main.

Create a view container element:

/wp-content/uploads/2013/01/step12_175101.png

13.Now go to properties tab and click on create button

/wp-content/uploads/2013/01/step13_175102.png

Choose the interface controller of used component.

/wp-content/uploads/2013/01/step17_175106.png

And click on tick mark.

Now you can see the below screen shot. Where component 1 is accessible with in the view of component 2.

/wp-content/uploads/2013/01/step15_175108.png

14. Now go to methods tab.

      Create a new method (Event handler) and choose the drop down as event instead of method.

/wp-content/uploads/2013/01/step16_175109.png

Now go to event column and choose f4 help, where you can choose the event which is declared in the component 1.

/wp-content/uploads/2013/01/step17_175106.png

Click on tick mark. Now this method is the event handler for the event E1.

So when ever event E1 Raises, this method will be triggered..

/wp-content/uploads/2013/01/step18_175111.png

Now go inside the event handler method .

Write some Success message..

So when ever the event is triggered , the success message  will be displayed.

/wp-content/uploads/2013/01/step19_175112.png

Source Code :

* get message manager
data lo_api_controller     type ref to if_wd_controller.
data lo_message_manager    type ref to if_wd_message_manager.

lo_api_controller ?= wd_This->Wd_Get_Api( ).

CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = lo_message_manager
.

* report message
CALL METHOD lo_message_manager->REPORT_SUCCESS
EXPORTING
MESSAGE_TEXT              = ‘ Event handler method is triggered sucessfully’.


15 Now go  Windows ..

/wp-content/uploads/2013/01/step20_175113.png

Right click on vc(View container) and choose embed.

/wp-content/uploads/2013/01/step21_175114.png

Now choose the f4 help on view to be embedded and choose component 1’s view

/wp-content/uploads/2013/01/step22_175115.png

Click on tick mark..

So that the Component 1’s  view will be embedded with component 2’s view container.

/wp-content/uploads/2013/01/step23_175116.png

Now save the web dynpro component and activate it..

Create a web dynpro application and save it.

/wp-content/uploads/2013/01/step24_175117.png

Right click on web dynpro application and test it .

/wp-content/uploads/2013/01/step25_175118.png

Now the output screen is.

/wp-content/uploads/2013/01/step26_175119.png

Just click on the button,

It will trigger the even handler method and a success message will be displayed.

/wp-content/uploads/2013/01/step27_175120.png

Hope it is useful..

Regards

Aravindan






To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply