on 06-22-2007 11:38 AM
Hi,
can any body explain how to handle the events in webdynpro abap.
i want to know some concepts in general.
Thanks,
Hi Mahesh,
you can create event handlers under the actions tab in you view. evry event handler has an importing parameter wdevent of type ref to cl_wd_custom_event.
you can also create events in your component controller and they can be handled within your views
check cl_wd_custom_event class for details about what all information you get when an event occurs.
for further details you can check out the following links
http://help.sap.com/saphelp_nw04s/helpdata/en/eb/ed6f4169e25858e10000000a1550b0/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/a9/c751415e3b6532e10000000a1550b0/frameset.htm
also you can try the tutorial at the following link for further clarity
Regards,
Shweta
Message was edited by:
Shweta R Shanbhag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are events associated with the various UI elements. Like lead selection for a table, click for a button etc. When you define these UI elements in your view, you need to define an action to be performed on the UI element. This will be done in the properties tab of the element. In this case, the event handler will be generated. It will have wdevent, a reference of the class cl_wd_custom_event as a parameter.
Events can also be used to trigger methods across components. You can define an event in your view or component controller, and explicitly "fire" the event. You need to write your own event handlers to handle the event.
in addition to add to my above question
if we write an event how we exactly do that?
where we write event how we handle event ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You go to the events tab of your view. Add an event, say event1.
Then go to the methods tab, Add a method, say handle_event1. In the method type, select "Event Handler". Then in the event field of the method, press F4 and select your event name. So you have defined the method handle_event1 for the event event1. Now navigate to your method and write your code!
Hi Mahesh,
events are very useful when you make use of component_usages. Consider that
the using components need to be informed when some state in the used
component is reached.
Take the ALV component as example. When the user clicks a button the
component that uses the ALV may need to perform some action on the data
displayed by the ALV component. Therefor you register for the corresponding
event.
Cheers,
Sascha
Message was edited by:
Sascha Dingeldey
why should i go for events and event hadler, any how i am not defining any thing in events, my code is again written in view controller method, so instead of going events why can't i use methods only (by passig parameters if reuqired like in events).
pleae let me know in detail..
Thanks,
Mahesh
Events can be especially useful in a cross component scenario where you can write handlers to events defined in other components. As Sascha already mentioned, the ALV and even OVS are good examples for this. You would handle the events defined in the OVS component in your own component. You do not need to know anything about which method to call etc. Just handle the OVS event and your search help will work.
Otherwise, within a single component, events are probably just one more way of doing things. What you achieve by a method call can also be achieved by firing events which will in turn call the event handlers.
A better way to understand will be to try and implement a similar functionality by using events, using methods etc. It will help you get a better understanding.
Regards,
Nithya
also in addition to what all the gurus have said ...difference between an eventhandler and a method is ...event handler is in response to an event like clicking of a button.
Suppose you want to search something and screen has a button SEARCH.If you don't write an eventhandler called ONACTION..for this how will you know when to call search functionality???
Of course you can write the code for search inside a method which you call inside the eventhandler....
Hope this improves your understanding
Hi,
In general, you can keep in mind the following things.
1) An event needs to be defined in the component controller.
2) There has to be an event generation scenario which can have a fire_evt statement (eg. say inside a piece of code, you say, if the object was found, fire event display - by calling method fire_<evt_name>_evt on the controller instance)
3) Lastly, you need an event handler method which will do the corresponding processing. This can lie in the same component or a using component. The type of the method has to be specified from the drop down list and the event has to be selected using F4 Help.
This is a very general explanation. You can look into the documentation anytime for the details.
Hope this helps.
Regards,
Neha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you handle a an event by creating an event handler which will take care of the event.
Eg: if you are using a button then on click of a button you want to perform some action...you can write the code for doing so in the onaction property of the button under the eading event.Each onaction event handler has a parameter called WDEVENT which contains information about the data selected etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mahesh,
You can refer to the following link to get more information about WebdynPro ABAP and how to develop applications.
http://help.sap.com/saphelp_nw04s/helpdata/en/77/3545415ea6f523e10000000a155106/frameset.htm
It contains a lot of tutorials too.!
Regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.