on 06-18-2007 7:57 PM
hi gurus,
I'm doing WD for ABAP and I'm trying to get contents into a dropdown list. I'm using DropDownListByKey. The contents come from a customizing table. I'm not sure where exactly I should add my coding: does it go into a supply function for my context attribute? Or in the method WDDOINIT? Basically, if you could point me towards some sample code, it would very user
Thanks in Advance,
Regards,
Ravi.
Ravi, is <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/c5/e4884180951809e10000000a155106/frameset.htm">this</a> not complete source of information?
BTW, context attribute doesnt` have supply function. Supply function exist only for nodes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
With the help of the following code,I am filling the value in my dropdown list manually(ls_value-key = '0000000001').
DATA lr_node_info TYPE REF TO if_wd_context_node_info.
DATA ls_value TYPE wdy_key_value.
DATA lt_value_set TYPE wdy_key_value_table.
*-----get the pointer to meta data
lr_node_info = wd_context->get_node_info( ).
lr_node_info = lr_node_info->get_child_node( `NODE_KNA1MOD` ).
*----- build set of keys to slect from.
ls_value-key = '0000000001'.
ls_value-value = 'value1'.
APPEND ls_value TO lt_value_set.
ls_value-key = '0000000002'.
ls_value-value = 'value2'.
APPEND ls_value TO lt_value_set.
*.... repeat append for as many entries required in dorp down
*----- Set attribute meta data
lr_node_info->set_attribute_value_set( name = `KUNNR`
value_set = lt_value_set ).
But my requirement is, <i><b>I want to fill the customer no in the drop down list from the kna1 table</b></i>.
Can any body guide me,how to fill the kunnr value in the drop down list from kna1 table.
Thanks in Advance,
Regards,
Ravi.
In the doinit method, do this
data: lt_valueset type standard table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_node_info type ref to if_wd_context_node_info,
lr_node type ref to if_wd_context_node,
wa_kna1 type <your kna1 table type>.
lr_node = wd_context->get_chilod_node( 'NODE_KNA1MOD' ).
lr_node_info = lr_node->get_node_info( ).
loop at kna1 into wa_kna1.
ls_valueset-value = wa_kna1-kunnr. "this will be the selected value
ls_valueset-text = wa_kna1-kunnr. "this will be the displayed value in the UI
append ls_valueset to lt_valueset.
endloop.
lr_node_info->set_attribute_value_set(
exporting
name = 'KUNNR'
value_set = lt_valueset ).
Hope this helps.
Regards,
Nithya
Hi,
As per your suggestion,i implemented the following code in the doinit Method,
but there is no value is populated in my dropdownlist box.
I check the code by debugging, <b><i>i am not getting any value in the following area
( ls_valueset-value = wa_kna1-kunnr.
ls_valueset-text = wa_kna1-kunnr. )</i> </b>
kindly check the following code.
data: lt_valueset type standard table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_node_info type ref to if_wd_context_node_info,
lr_node type ref to if_wd_context_node,
wa_kna1 type kna1,
lt_kna1 like table of wa_kna1.
lr_node = wd_context->get_child_node( 'NODE_KNA1MOD' ).
lr_node_info = lr_node->get_node_info( ).
loop at lt_kna1 into wa_kna1.
ls_valueset-value = wa_kna1-kunnr. "this will be the selected value
ls_valueset-text = wa_kna1-kunnr. "this will be the displayed value in the UI
append ls_valueset to lt_valueset.
endloop.
lr_node_info->set_attribute_value_set(
exporting
name = 'KUNNR'
value_set = lt_valueset ).
In the LAYOUT: i binded the selected key properties as kunnr.
properties
selectedkey = kunnr.
kindly give me some suggestion,to come out of this problem.
Thanks in advance,
Regards,
Ravi.
Hi Ravi,
Is there value in your internal table? I assumed you already have the data in your itab and are moving it to the value set by looping into a work area. You need to fetch data in your internal table from your db table or populate it using an API or whatever.
In your case, since you want data from the kna1 table, that data should be available in lt_kna1. Select based on whatever condition you want.
If you have data in your itab, I do not see why this wouldnt work.
Regards,
Nithya
Message was edited by:
Nithya S
Hi Ravi,
chek this out:
https://forums.sdn.sap.com/click.jspa?searchID=3258437&messageID=3281841
Cheers,
Sascha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.