on 07-20-2008 1:19 PM
Hi Experts,
I ahve a drop down by key which has 4 values , but it shows blank as initial load up and i have to expand the dropdown to view the 4 values, could some on please tell me how to set one of my values as the default one so that i wouldnt have a blank entry on first run of the view.
Replies would be gratefully acknowledged,
Chaitanya.
Hi Chaitanya,
In case ur problem is not solved yet..Just change the SELECTION property of the Context node you are binding with the dropdown Key UI element to 1..1.
Hope it will resolve the issue.
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I came across the same requirement and dont know whether the way i solved the problem was right or wrong but yes i solved it.
In my case i had 6 values in dropdown by key and first value coming was blank, i just wanted that instead of blank i should get SELECT as default value.
You can use following code to solve this problem (it really removes the blank and puts this value in your DBK by default)
data: node type ref to if_wd_context_node.
DATA: str1 type string.
data: find type if_main=>element_zfind.
str1 = 'SELECT'.
node = wd_context->get_child_node( 'ZFIND' ).
find-zfind = str1.
node->bind_structure( find ).
NOTE: important thing is that you should have this default value (in my case SELECT ) should be there in your value range or else it will give you a DUMP.
try it if u get any problem just ask me.
regards
panky
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's fairly simple: you just need to make sure there is a value in the context attribute that is data bound to this UI element.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Hi Thomas,
>
> There is one value which is bound to this dropdown element but that is only visible on expanding the dd (which is blank bfore i expand), i would like it to be displayed when the screen loads up.
>
> Thanks 4 Ur Help,
> Chaitanya
I would check your binding, as something must not be correct. What value is in the context attribute that is bound to the selectedKey property will show as selected in the DDLBKey when the screen is first shown. There is nothing you should need to do to make this happen - except properly bind to an attribute that has a value.
Chaitanya, check this code and adapt it to yours. I'm assuming you've already built the valueset table so I'm not including that part:
DATA:
lt_value_set TYPE wdr_context_attr_value_list,
lr_node TYPE REF TO if_wd_context_node,
lr_node_info TYPE REF TO if_wd_context_node_info.
lr_node = wd_context->get_child_node( wd_this->wdctx_(YOUR NODE) ).
lr_node_info = lr_node->get_node_info( ).
* Set possible values for the atribute
lr_node_info->set_attribute_value_set(
name = iv_attr_name " Your attribute bound to the dropdown by key, e.g. 'ATTR1'
value_set = lt_value_set
).
IF iv_initial_value IS SUPPLIED.
* Set initial attribute value (it SHOULD exist on the table lt_value_set!)
lr_node->set_attribute(
value = iv_initial_value
name = iv_attr_name " Your attribute bound to the dropdown by key
).
ENDIF.
Regards
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.