cancel
Showing results for 
Search instead for 
Did you mean: 

Data population from dropdown(Dropdownbykey) to table and vice versa.

Former Member
0 Kudos

Hi all,

I have a table and a popup. For each column in the table i have a corresponding dropdown(dropdownbykey) in the popup so as to add new records or to edit the existing record in the table.

Now for the dropdownbykey in the popup , i binded it with the text value in the structure used for context binding. Now while i save the data , the value appears in the table , but i need it to be description.How can i achieve tht??

i mean for every description selected in the dropdown in the popup , its corresponding key value gets saved in the table...but i want it to be the same description as it appears in the popup.Please help..

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In the structure/table you popualate consider take another column for description as you have the value,Before saving entries to the database table, for all the records that you have got the value, you need to populate the description for that value and modufy the table again. save it to DB table.

DRPBYKEY I assume that this has fixed set values or value table.

If it a value table then get the text table values.

For ex: if you node has the column1, column2(this is dropbykey), column3(description).

if my domain has these values

01 BILLABLE

02 NON BILLABLE

If the column2 has the 01 entry for 1st record.

Loop at lt_table into ls_table.
lv_tabix = sy-tabix.
if ls_table-column2 eq '01'. 
ls_table-column2 = 'BILLABLE'.    "If text table then read the table with that key
elseif ls_table-column2 eq '02'.
ls_table-column2 = 'NON BILLABLE'.
endif.
modify lt_table from ls_table index lv_tabix.
endloop.

Now save it to DB table.

Regards,

Lekha.

Former Member
0 Kudos

Hi lekha,

I would like to explain u my situation...Here in the popup i have three drpdowns where 2nd one gets populated depending on the value selected in the first drpdown...and 3rd one gets populated depending on the value selected in the 2nd one..nw how can i know the key in advance ...or rather i have to write a very lengthy code...Do u have any other suggestions.???

Former Member
0 Kudos

Hi,

For that column of table you can implement the ONACTION method for the DRPBYKEY.

In that you will get to know the value using the WDEVENT parameter.

Now you write the necessary coding.

Check the WDR_TEST_TABLE ->view(TABLE_CELL_EDITOR) ACTION method for DRPBYKEY.

Now you will get that index and the value also. Using this loop the table and fill the other attributes(3rd columnvalue) and bind the table again.

Regards,

Lekha.