on 01-12-2009 6:44 AM
Hi All,
I need to display date and time in a dropdown. Can someone help me with this ?
Thanks.
Hi
1) If you want to display date & time in dropdown, insert 2 DropDownByKey UI elements on the screen
2) Map them with Context aatribute
3) write following code in the wdinit method of the view
DATA NODE_INFO type ref to IF_WD_CONTEXT_NODE_INFO.
NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).
NODE_INFO = NODE_INFO->GET_CHILD_NODE( name = `NODE WHICH CONTAILS ATTRIBUTE` ).
DATA: t_valueset type WDR_CONTEXT_ATTR_VALUE_LIST,
t_value type WDR_CONTEXT_ATTR_VALUE.
INSERT THE VALUES YOU WANT TO DISPLAY IN THE TABLE t_valueset USING LOOP-ENDLOOP * OR DO-ENDDO
eg. -
loop at stru_it_rake_dtls.
t_value-VALUE = "VALUE TO BE DISPLAYED.
t_value-TEXT = "TEXT OF THE VALUE.
INSERT t_value into table t_valueset.
endloop.
NODE_INFO->SET_ATTRIBUTE_VALUE_SET(
NAME = `NAME OF THE ATTRIBUTE YOU WANT TO DISPLAY`
VALUE_SET = t_valueset ).
*Repeat the same procedure for both UI elements
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you wont be able to display both time and date in different format in same drop down....
you have to keep the type of the attribute to string and you have to convert both time and date to string type before appending it to internal table which you will bind with your drop down...
regards
pranav
Hi,
The method to fill drop down has been given by Saket what you have to do is...
first convert date to string type using below code..
DATA : v_date type dats,
output_date_string(10) type c .
v_date = sy-datum .
write v_date to output_date_string .
now similarly convert time in string format....
DATA: node_info TYPE REF TO if_wd_context_node_info,
value TYPE wdy_key_value,
value_set TYPE wdy_key_value_table.
CLEAR value_set.
node_info = wd_context->get_node_info( ).
node_info = node_info->get_child_node( `CN_TABLE` ).
.
value-key = "date_key". " give key for date here
value-value = output_date_string .
INSERT value INTO TABLE value_set.
similarly insert for time
value-key = "time_key". " give key for time here
value-value = output_time_string .
INSERT value INTO TABLE value_set.
* Setting the corresponding attribute value
node_info->set_attribute_value_set( name = `CA_attr`
value_set = value_set ).
above code is for drop down by key....
regards
Pranav
Hi,
yes you can display date and time in a drop down... it is simple like displaying any thing in drop down....
regards
Pranav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.