on 07-03-2009 12:44 PM
Hi ,
I have a requiremnent where I have a button WD UI element in my tray ( row layout ) .
Now , on every single click of button , I want one dropdown by key UI element to appear in the layout , which is auto populated with values from the Ztable .
Can any one tell me , how to do this in WD ABAP .
regards ,
amit
Hi,
I just created a test application which does somewhat what you required:
First add a btn to your layout...create an event method for it....
I also added a transparent container with ID = CONT10
I also created a global attribute "Count" under the tab called "Attributes"...which is right beside the "Context" tab...which is right beside the "Outbound Plugs" tab....i guess now you should be able to find that tab
this "count" is there to create distinct id's for dropdowns....
count is of type N.
I also created another global attribute "FLAG_CREATE_DD" of type wdy_boolean
Set this attribute to abap_false in your view WDDOINIT method:
wd_this->FLAG_CREATE_DD = abap_false.
the reason is we do not want to create the dropdown first time user gets to your view.....
we set this flag to abap_true under your btn action method.
wd_this->FLAG_CREATE_DD = abap_true.
so when the user clicks the btn...the flag becomes true...and the code in wddomodifyview can execute:
My view name: MODEL_ENTRY
my context where the drop down values are stored is as follows:
DAYS_MODEL_NODE <---this is my node
->DAYS_MODEL_VALUE <-this is my attribute of type string.
-
-
you can add this code to your WDDOMODIFYVIEW:
if wd_this->FLAG_CREATE_DD = abap_true.
DATA: lo_container TYPE REF TO cl_wd_uielement_container,
lo_dd_ind TYPE REF TO cl_wd_dropdown_by_idx,
lo_matrix_data TYPE REF TO cl_wd_matrix_data.
DATA dd_indx_id TYPE string.
lo_container ?= view->get_element( 'CONT10' ).
wd_this->count = wd_this->count + 1.
dd_indx_id = 'DD_1'.
CONCATENATE dd_indx_id wd_this->count INTO dd_indx_id.
lo_dd_ind = cl_wd_dropdown_by_idx=>new_dropdown_by_idx(
bind_texts = 'DAYS_MODEL_NODE.DAYS_MODEL_VALUE'
id = dd_indx_id
view = view ).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lo_dd_ind ).
lo_container->add_child( lo_dd_ind ).
endif.
now if user clicks on the btn....they produce drop down ui....
hope this helps....
thanks...
AS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can control this...by creating a flag of type wdy_boolean...once a user presses a btn...we can make it true...and once we are exiting the "if" condition inside the wddomodify method...you can make it false again...
like this:
inside the button aciton:
wd_this->FLAG_CREATE_DD = abap_true.
inside the wddomodify:
IF wd_this->flag_create_dd = abap_true.
DATA: lo_container TYPE REF TO cl_wd_uielement_container,
lo_dd_ind TYPE REF TO cl_wd_dropdown_by_idx,
lo_matrix_data TYPE REF TO cl_wd_matrix_data.
DATA dd_indx_id TYPE string.
lo_container ?= view->get_element( 'CONT10' ).
wd_this->count = wd_this->count + 1.
dd_indx_id = 'DD_1'.
CONCATENATE dd_indx_id wd_this->count INTO dd_indx_id.
lo_dd_ind = cl_wd_dropdown_by_idx=>new_dropdown_by_idx(
bind_texts = 'DAYS_MODEL_NODE.DAYS_MODEL_VALUE'
id = dd_indx_id
view = view ).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lo_dd_ind ).
lo_container->add_child( lo_dd_ind ).
wd_this->flag_create_dd = abap_false. <-----this is the initial value for this flag
ENDIF.
this will prevent it from getting created.....for other actions on the layout....
Thanks....
AS.
Edited by: J Are on Jul 10, 2009 12:36 PM
Hi,
First create the dropdown UI element and create a context attribute for the visibility for that.
In the button handler/action, set the visiblity of this dropdown and also get the contetnts from table and bind this to the node to which the dropdown is bound.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
no , my requirement is such that
when user click on button for 1st time , one dropdown should appear .
the next time he clicks , another dropdown should appear . I mean I donot know in advance
how many times the user would click and that dropdown would appear .
I suppose this is achievable through dynamic programming .
how can it be achieved , can u elaborate me that .
Hello Amit,
You need to include the following code in the wddomodifyview method of view.
DATA: l_root_cnt TYPE REF TO cl_wd_uielement_container,
l_text_view TYPE REF TO cl_wd_text_view,
l_flow_data TYPE REF TO cl_wd_flow_data.
Check whether the method is called for the first time
IF first_time = abap_true.
Get the reference for thr ROOTUIELEMENTCONTAINER
l_root_cnt ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
Call the method(generally starts with word new) of the corresponding class(UI specific)
here I have used textview, you can replace it with dropdrown UI element.
l_text_view = cl_wd_text_view=>new_text_view( id = 'TEXT_VIEW_ID'
text = 'YOUR TEXT' ).
l_root_cnt->add_child( l_text_view ).
Decide on the layout property of the UI Element.
l_flow_data = cl_wd_flow_data=>new_flow_data( element = l_text_view ).
ENDIF.
Regards
Anurag Chopra
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.