cancel
Showing results for 
Search instead for 
Did you mean: 

Not getting any values in dropdown list

Former Member
0 Kudos

Hello Friends,

I have created a DropDownByKey and binded it to the the attribute (ZDAYS) of context node (MY_PO_INV). I have set Property for cardinality as 1..1 and for Selection as 0..n. I tried 0..n and 1..1 as well. However, I do not get any value when I run the WD appl. I got once but, I don't remember what changes I made and it does not work now. Any help shall be appreciated.

I have written the below code in the WDOINT method and getting 3 records (Last 30 Days, Last 60 Days, Last 90 Days) in lt_days.

if ls_days IS INITIAL.

ls_days-value = 'Last 30 Days'.

ls_days-text = 'Last 30 Days'.

APPEND ls_days to lt_days.

endif.

if ls_days IS NOT INITIAL.

ls_days-value = 'Last 60 Days'.

ls_days-text = 'Last 60 Days'.

APPEND ls_days to lt_days.

endif.

if ls_days IS NOT INITIAL.

ls_days-value = 'Last 90 Days'.

ls_days-text = 'Last 90 Days'.

APPEND ls_days to lt_days.

endif.

DATA lo_nd_my_po_inv_info TYPE REF TO if_wd_context_node_info.

lo_nd_my_po_inv = wd_context->get_child_node( name = wd_this->wdctx_my_po_inv ).

lo_nd_my_po_inv_info = lo_nd_my_po_inv->get_node_info( ).

lo_nd_my_po_inv_info->set_attribute_value_set(

EXPORTING

name = 'ZDAYS'

value_set = lt_days ).

Thks & Rgds,

Hemal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Try with Cardinality set as 1-1 or 1-n. These two are only options possible for drop down.

For Selection , you can try with different options.

http://help.sap.com/saphelp_erp2005/helpdata/EN/7a/787e40417c6d1de10000000a1550b0/frameset.htm

Thanx.

Former Member
0 Kudos

Hello All,

Thanks very much for your input. I tried all the combinations of Cardinality and Selection. Also, I tried the code provided by Radhika. It still does not show any value in the dropdown list. Is there anything else I can do to get the value ?

Thks & Rgds,

Hemal

Former Member
0 Kudos

Hello All,

I was putting the code at the wrong place. I have 3 layers of model. The View layer, model and the application layer. I was putting the code at wdoinit method of Application layer. It works when I put it in View layer as I believe the Views has been defined in it. I tried the Cardinality 1..n and Selection 0 ..1 and it works fine.

But, I get the default value as blank. When I clicks on the dropdown arrow it shows the list of (Last 30 Days, Last 60 Days and Last 90 Days). Can anyone please tell me how do I default to "Last 30 Days" instead of the blank value.

Thks & Rgds,

Hemal

Edited by: hemalgandhi on Apr 26, 2009 7:52 PM

Former Member
0 Kudos

hi,

check out this thread :

or .

I hope this would help you.

Thanx

Saurav.

Former Member
0 Kudos

Set the dropdown default value in the WDDOINIT method as follows:

data: node_category   TYPE REF TO if_wd_context_node.

node_category = wd_context->get_child_node( 'NODE NAME' ).

* set dropdown value
node_category->set_attribute( exporting name = 'ZDAYS'
                  value  = 'Last 30 Days' ).

OR

Goto the node and directly set the 'Default Value' against the attribute 'ZDAYS'.

Hope it helps.

Regards,

Radhika.

former_member40425
Contributor
0 Kudos

Hi,

Go to the properties of attribute ZDAYS and set Default value as 'Last 30 Days'.

It may help You.

Regards,

Rohit

Former Member
0 Kudos

Hi Hemal,

If you are using the drop down by key its not possible to get a default value through code ,.

only thing you can do is giving the default value in the properties of that node.

But if your displaying only texts better go for drop down by index where u can get the default value through code.

Former Member
0 Kudos

hi,

Default value can be set for Dropdown by key.

just Set the Attribute which is binded to your Dropdown by key with the Value you want to.

It will appear in the Drop down by default.

Thanx.

Former Member
0 Kudos

Kindly close the thread if you have got the solution.

Regards,

Radhika.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Give cardinality 1..1 and selection 0..1 to your context node MY_PO_INV and bind the attribute ZDAYS to the selected key property of drop down.

What ever the code you wrote for populating values for drop down i.e correct.I think problem is cardinality.

Former Member
0 Kudos

Hi Hemal,

Bind the "selectedKey" property to the context attribute 'ZDAYS' and fill the value set.

Write the following code in the WDDOINIT method.

method WDDOINIT .

DATA:
node_category TYPE REF TO if_wd_context_node_info.

node_category = WD_CONTEXT->GET_NODE_INFO( ).
node_category = node_category->GET_CHILD_NODE( 'MY_PO_INV' ).

data: LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST,
  L_VALUE type WDR_CONTEXT_ATTR_VALUE.

L_VALUE-VALUE = 'Last 30 Days'.
L_VALUE-TEXT = 'Last 30 Days'.
INSERT L_VALUE into table LT_VALUESET.

L_VALUE-VALUE = 'Last 60 Days'.
L_VALUE-TEXT = 'Last 60 Days'.
INSERT L_VALUE into table LT_VALUESET.

L_VALUE-VALUE = 'Last 90 Days'.
L_VALUE-TEXT = 'Last 90 Days'.
INSERT L_VALUE into table LT_VALUESET.

SORT lt_valueset.

node_category->SET_ATTRIBUTE_VALUE_SET(
NAME = 'ZDAYS'
VALUE_SET = LT_VALUESET ).

endmethod.

Regards,

Radhika.