cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Down list in Table

Former Member
0 Kudos

Hi,

Is it possible to have a Drop drop list as a field in the Table????

If yes, can anybody help me out as to how to assign data to the drop - down list in the table and to add data to the table.

Thanks and Regards,

Kanakaraj V A

Accepted Solutions (0)

Answers (4)

Answers (4)

florian_royer
Participant
0 Kudos

A good example for possible fields in a table:

WDR_TEST_table

Regards,

Florian Royer

Former Member
0 Kudos

hi,

-> Yes it is possible to create drop down in the column of a table.

For this, add a table UI Element and thus further add column to the table. Now to that column you can add drop down.

-> For populating data to the table. Just write the code in the WD Doinit Method.

The code belows :

->Creates an internal table.

->Moves all data into an internal table.

->Finally bind this internal table to the Context Node to which Table UI Element is binded.

The below code will display data in the node.

Data : it_table type STANDARD TABLE OF sflight.

DATA lo_nd_for_table TYPE REF TO if_wd_context_node.

DATA lo_el_for_table TYPE REF TO if_wd_context_element.

DATA ls_for_table TYPE wd_this->element_for_table.

  • navigate from <CONTEXT> to <FOR_TABLE> via lead selection

lo_nd_for_table = wd_context->get_child_node( name = wd_this->wdctx_for_table ).

select carrid connid fldate from sflight into CORRESPONDING FIELDS OF TABLE it_table.

lo_nd_for_table->bind_table( it_table ).

If you want to populate data into drop down.

Then populate data in internal table and then set the attribute of drop down with the internal table.

You can set the particular attribute with the help of Code Wizard(Control + F7).

Thanx.

Former Member
0 Kudos

Hi

first create a table under that create column insert drop down by key in it

u would be populating it thorugh some table write name it instead of t578w

and write field name in instead of stext .CN_TABLE is node binded to table.If u dont have key

then give the name of field there.ZBLDGROUP is context attribute binded to that drop down.Just go through it .

************************************************************************

************************************************************************

*declaration of vaiables

************************************************************************

DATA: value TYPE wdy_key_value,

value_set TYPE wdy_key_value_table.

************************************************************************

*declaration of node references

************************************************************************

DATA: node_info TYPE REF TO if_wd_context_node_info,

litab_healthinform TYPE TABLE OF t578w.

FIELD-SYMBOLS: <pin_f> TYPE t578w.

************************************************************************

*METHOD FOR DEFAULT VALUES OF ZPIN IN DROP DOWN by key LIST START HERE

************************************************************************

CLEAR value_set.

node_info = wd_context->get_node_info( ).

node_info = node_info->get_child_node( `CN_TABLE` ).

CALL METHOD Z_GET_TABLE_DATA=>GET_TABLE

EXPORTING

tab = 'T578W'

IMPORTING

data = litab_healthinform.

APPEND INITIAL LINE TO litab_healthinform .

LOOP AT litab_healthinform ASSIGNING <pin_f> .

value-key = <pin_f>-wtfld.

value-value = <pin_f>-stext.

INSERT value INTO TABLE value_set.

ENDLOOP.

node_info->set_attribute_value_set( name = `ZBLDGROUP` value_set =

value_set ).

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

Yes, it is possible.

Instead of Text View, as cell editor of the Table Column, choose Drop Down By Key.

You can assign Value list to the Context Attribute Using.

place the following code in the WDDOINIT, to assign value set to the context attribute.

DATA: lr_info type ref to if_wd_context_node_info.

data: lr_node type ref to if_wd_context_node.

data: lt_valueset type standard table of wdr_cotnext_attr_value.

data: ls_valueset type wdr_cotnext_attr_value.

lr_node = wd_context->get_child_node( '<node name>' ).

lr_info = lr_node->get_node_info( ).

ls_valueset-value = '1'.

ls_valueset-text = 'First Value'.

append ls_valueset to lt_valueset.

ls_valueset-value = '2'.

ls_valueset-text = 'Second Value'.

append ls_valueset to lt_valueset.

lr_info->set_attribuet_value_set( name = '<Context_ATtribute_name>' value_set = lt_valueset ).

Now, the dropdown will display First Value and Second Value options.

Abhi