on 2009 Feb 26 7:47 AM
Hi all,
I have two methods method1 and method2 in a single view.
i want to call method1 in method2...by using code wizard i could able to call method1.
the method1 is showing a parameter wdevent. What should i pass in this? what is the functionality of this. Please let me know.
Thanks
Swapna
hi,
Your method one is a event?
if that is case then you you have to decalre a variable of this cl_wd_custom_event type and pass.
The event methods have this parameters as default.
Best regards,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swapna,
{quotethe method1 is showing a parameter wdevent. What should i pass in this? what is the functionality of this{quote}.
This means that method1 is actually an EVENT HANDLER method, if you go to the ACTION tab should
see that on some ACTION this method gets called. Action <---> EVENT HANDLER
i want to call method1 in method2
ideally u should not be calling the EVENT HANDLER methods within another method, its bad design.
Method for reuse must be written in component controller, for use across views. However you can use dummy EVENT object and call the method1 from inside method2 as below
method method2.
.
.
.
DATA: lo_dummy type ref to cl_wd_custom_event.
create object lo_dummy.
method1( lo_dummy ) .
.
.
.
end method.
check below thread on details
Greetings
Prashant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swapna,
You can try this method as well:
- Create an event in the component controller and check the inface check box.
- now go to your view and create a new method and in the event field of that method select the event which you created in the component controller. In this method write the code which is in your method 1.
- now go to method 2 and with the help of code wizard fire the event which you created. Press ctrl+ f7, select 'call method in used controller', select component controller and then select the event name.
- when this event is fired, the method associated with it will be called.
I hope it helps.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
DATA: WDEVENT type CL_WD_CUSTOM_EVENT.
WDEVENT is used to capture the UI element events that you have created on the View. For example, you have two buttons button1 and button2, and need to capture the event during run time, then the following works,
data l_button_name type string.
l_button_name = wdevent->get_string( name = 'ID' ).
case l_button_name.
when u2018button1u2019.
wd_comp_controller->go_to_button1( ).
when ' button2'.
wd_comp_controller-> go_to_button2( ).
endcase
Thanks,
S Rajkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.