on 04-18-2013 10:35 AM
Hi experts,
I'm developing a part of code which dynamically generates a button and set an ON_ACTION clause to bind it to an action:
bd_toolbutton_edit = cl_wd_toolbar_button=>new_toolbar_button( text = 'Edit' on_action = 'EDIT_DATA' ).
Problem: I could have many buttons on my WD application and I'd like to code just one ONACTIONEDIT_DATA method to manage them all.
In order to do so, I'd like to receive an ID as parameter in the method ONACTIONEDIT_DATA so that my method "knows" which button has been pressed.
I don't know anyway how to pass that parameter to the action since it is all made via dynamic programming.
Thanks
Hi Matteo,
the method new_toolbar_button already has a parameter called "ID".
In the action you should be able to get the ID with
READ TABLE wdevent->parameters
ASSIGNING <ls_parameter>
WITH KEY name = 'ID'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Problem: I could have many buttons on my WD application and I'd like to code just one ONACTIONEDIT_DATA method to manage them all.
I just seek a small clarification, How you are going to handle all the buttons in ONACTIONEDIT_DATA method. Because as this is an event handler it will be called when you click on edit button and not for other buttons isn't it?
If you are creating a generic method to handle all the buttons, you can create actions for all the buttons and get the button action which is clicked using the below code:
data lo_api_controller type ref to if_wd_view_controller.
data lo_action type ref to if_wd_action.
lo_api_controller = wd_this->wd_get_api( ).
lo_action = lo_api_controller->get_current_action( ).
lo_action->name contains the action name of clicked button .
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.