cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown Fill

Former Member
0 Kudos

Hi i am a java developer hence find wd-abap and simple abap a little challenging,

i have a table 'Lang' with 2 fields 'Code' and 'Text '

My FM returns me a internal table IT_Employee with only CODE to which i mapped the UI,

to get the text for this code i have to get it via.....below..provosion.

My FM also returns me a internal table IT_LANG which has all the Code and Text in it ,

How can i code so that when i clcik on the UI (inputbox/dropdown) it must give me both Code and text or atleast text?

Accepted Solutions (1)

Accepted Solutions (1)

former_member199125
Active Contributor
0 Kudos

Hi Jack,

Create an input field and bind an string attribute to it.then in wddoinint write the below code, then two fields will dispaly if you clck on F4

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('NODENAME').

DATA: lt_valueset TYPE wdr_context_attr_value_list,

l_value TYPE wdr_context_attr_value.

l_value-value = '30'.

l_value-text = 'Casual Leave'.

INSERT l_value INTO TABLE lt_valueset.

l_value-value = '10'.

l_value-text = ' Priviliged Leave'.

INSERT l_value INTO TABLE lt_valueset.

node_info->set_attribute_value_set( name = 'ATTRIBUTENAME' value_set = lt_valueset ).

NOW INPUTFILED WILL GET 10 Privilged leave

30 casual leave

It works only for input field not for dropdown

Regards

Srinivas

Former Member
0 Kudos

soory was not well and absenf from work, whne i joined i was suprised to see the new sdn version......was LOST...did not understand how to go ahead and what to do....

will try the above and come back in a day ...cheers.

Former Member
0 Kudos

Srini Thanks a Lot, i was able to fill all my data using the simple logic you provided.

Regards,

Jack.

Answers (2)

Answers (2)

ajoy_chakraborty
Participant
0 Kudos

Hi Jack,

I doubt about the feasibility of displaying two fields in Drop Down By Index.

However, instead of CODE, if you want to display TEXT only, then, it can be achived - while binding (TEXTS property of DropDownBy Index) use TEXT instead of CODE

Former Member
0 Kudos

Hi thanks Text is perfectly fine with me, please suggest steps ...a sample code would be appriciated.

above mentioned links and docs seems to be too tedious just for a small task, in java we write a subroutine create a Fillnode and map it to the dropdown....its simple

ajoy_chakraborty
Participant
0 Kudos

Steps (to replicate the scenario):

1) I have created a database table using SE11 transaction. Table fields: NAME - CHAR20 and SURNAME - CHAR20

2) SE80 -> Create webdynpro component -> WINDOW1, VIEW1

3) Go to COMPONENT CONTROLLER -> Context tab -> Right click on CONTEXT -> Create NODE (ITAB) (Cardinality 0..N, Selection 0..1)

4) Dictionary structure <table name> -> Click on ADD ATTRIBUTE FROM STRUCTURE -> Select NAME and SURNAME and click on OK

5) Create SUPPLY FUNCTION -> In supply function, use code wizard -> Select NODE/ ATTRIBUTE as ITAB -> READ option -> click ON

6) Write following code:



DATA ttab TYPE TABLE OF zaj_emp. "Enter your table name here

  SELECT * FROM zaj_emp INTO TABLE ttab.

  lo_nd_itab->bind_table( ttab ).

7) Go to VIEW1 -> CONTEXT tab -> drag and drop ITAB from CONTEXT COMPONENT CONTROLLER side to CONTEXT VIEW1 side to maintain Context Mapping

😎 View1 -> Layout tab -> drag and drop DROP_DOWN_BY_INDEX -> go to TEXTS property and maintain the binding with NAME or SURNAME (as per your requirement)

Hope it helps!

RicardoRomero_1
Active Contributor
0 Kudos

Hi,

Try with this;

[Using Drop Down By Index in Table UI Element in WebDynpro ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c03227f9-e48f-2c10-4bad-8ebdec704f3d?QuickLink=index&overridelayout=true&45290430176506]

Or this:

http://wiki.sdn.sap.com/wiki/display/WDABAP/WebDynproforABAPCellVariants

Regards,