on 09-15-2008 11:03 AM
I have a Drop Down for the month and a Pushbutton.
Say Ex: i have selected September and clicked the button. Now below that 30 input fileds need to get displayed as the number of days in september is 30. Similayly for February 28 fields should get displayed.
How can achieve this ?
which part is your problem? populating the list and fetching value from it or the dynamic addition of inputfields.
if you already have the list value and now want to add the 30 input fields then it goes as below in the wddomodifyview method
you will have to add labels along with inputfields as a label is required with an inputfield...also you need to make sure that the IDs of each of the labels and Inputfields are different so as to avoid duplication of ui element names on the view.
get selected value from the list.
case 'JAN'.
lv_counter = 31.
case 'FEB'.
lv_counter = 28. "or 29 as the case may be.
..
..
..
case 'DEC'.
lv_counter = 31.
endcase.
**get root containter reference.
DATA : lr_container TYPE REF TO cl_wd_uielement_container,
lr_inputfield type ref to cl_wd_input_field,
lr_label type ref to cl_wd_label.
data : lv_id type string,
lv_label_id type string
lv_temp_num(2) type n.
lv_temp_num = lv_counter.
concatenate 'INPUT' lv_temp_num into lv_id.
concatenate 'LABEL' lv_temp_num into lv_label_id.
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
do lv_counter times.
lr_label = cl_wd_label=>new_label( id = lv_label_id text = lv_temp_num ).
CALL METHOD lr_container->add_child
EXPORTING
the_child = lr_label.
lr_inputfield = cl_wd_input_field=>new_input_field( id = lv_id length = 10 ).
CALL METHOD lr_label->set_label_for( lv_id ).
CALL METHOD lr_container->add_child
EXPORTING
the_child = lr_inputfield.
enddo.
hope it helps....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jain,
I have to display the input fields based on the month(Drop down box).If it is February 28 input fields shoud get displayed. If is is september, 30 input fields should get displayed.
Here are some of my doubts,
1. How to design the Layout - Shall we go for Matrix Layout ? or ....
2. How many context elements do we need to create ?
Personally I wouldn't use dynamic coding in WDDOMODIFYVIEW at all. Instead I would use the MultiPane or RowRepeater to acomplish this. Either of these UI elements allows a variable number of inner UI elements based upon the binding to a context node. That way when the value of your drop down changes, you only have to adjust the internal table that is bound to the source context of the MultiPane or RowRepeater.
Hi Jung ,
Thanks for your valuable reply. I have another doubt.
I have created the context node with 31 input fileds and also in layout i have bounded these.
in wdmodify view, based on the following lines of code i have made the input fields invisible.
lr_inputfield ?= view->get_element( 'D1' ).
lr_inputfield->set_visible( '01' ).
Up to now it is OK. Now if i click on the pushbutton, i need to re-modify these input fileds. for that i need to write the code at the event on the button. But in the Button method i dont have the scope for view. Please suggest me the solution.
I don't understand why you are still using the WDDOMODIFYVIEW. Why are you setting input fields invisible? Why are you creating 31 inputfields in your context node? I don't think you understand what I mean by using the MultiPane or RowRepeater. The number of context elements controls how many UI elements get output. You don't need to set any fixed numbers at design time.
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.