on 10-26-2013 11:28 AM
Hi Experts,
I am able to create a button dynamically and attached the action
Below is the code.
data:root type ref to cl_wd_uielement_container,
bt type ref to cl_wd_button.
root ?= view->get_element('ROOTUIELEMENTCONTAINER').
bt = cl_wd_button=>new_button( text = 'Submit' on_action = `SAY_HELLO` ).
cl_wd_flow_data=>new_flow_data( element = bt ).
root->add_child( bt ).
In the method 'SAY_HELLO' I have written code to show one message. But it gives dump and does not allow me to create onactionsay_hello method even.
I have created SAY_HELLO as method type 1(i.e event handler method).
My expectation is :
One button should be created dynamically and after clicking it should prompt some message . and everything should happen dynamically.
Thanks.
And you can use this link for more information.
Creating UI Elements Dynamically in Abap Webdynpro Application - Web Dynpro ABAP - SCN Wiki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think code written by should work. try once code given by me. Still if you are getting dump. Please share the Dump's snap-shot.
METHOD wddomodifyview .
" For dynamic Programing we need to write code in modify view..
IF first_time = abap_true.
DATA lr_container TYPE REF TO cl_wd_uielement_container.
DATA: lr_matrix TYPE REF TO cl_wd_matrix_head_data,
lr_matrix_lay TYPE REF TO cl_wd_matrix_layout.
* ** getting reference of first ROOTUIELEMENTCONTAINER
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
cl_wd_matrix_layout=>new_matrix_layout( lr_container ) .
* Here we are Creating new button
DATA: lr_button TYPE REF TO cl_wd_button.
lr_button = cl_wd_button=>new_button(
id = `button_DYNAMIC`
text = 'Botton'
on_action = `METHOD_SHOW`
).
"NOTE: METHOD_SHOW should be statically available in your view... and in that write your code to show data and message
* Here we are adding new button in the TC..
lr_container->add_child( lr_button ).
cl_wd_matrix_head_data=>new_matrix_head_data( lr_button ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Chaudhury,
You are trying to map a method to the button, rather you should map an action to the button.
Instead of creating SAY_HELLO as method type 1(i.e event handler method). in method tab
Create an action say_hello in action tab.
I hope it will solve the problem.
Regards,
Rumeshbabu S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Chaudhury,
Refer the following link which explains Creating UI Elements(Table,Buttons) Dynamically in Abap Webdynpro Application.
Hope this will help you.
Thanks
Katrice
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.