cancel
Showing results for 
Search instead for 
Did you mean: 

DROP DOWN BY KEY IN WEBDYNPRO IN DESCENDING ORDER

Former Member
0 Kudos

Hi Experts,

In requirement i am using drop down by key, in this i have to fill years current year -40 years. For key and value i am passing YEAR(SAME), for acending order it is showing all years. For descending order it is giving dump??? How to solve this?? any help please

Thanks,

kris.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

using whcih method you are populating the values to dropdown.

If it is through WDR_KEY_VALUE_TABLE iit iis already sorted table no need to do anything

Please elaborate your query.

Thanks

Tulasi Palnati

Former Member
0 Kudos

Hi Tulasi thanks for your reply,

My drop down is displayingyears from 1970...current year, but i want to display current year-40. if i am coding reverse, its giving dump?? can u give me any code for this??

i am using this...

l_wa_year-key = sy-datum+0(4) - 39 .

l_wa_year-year = sy-datum+0(4) - 39 .

DO 39 TIMES.

l_wa_year-key = l_wa_year-key + 1.

l_wa_year-year = l_wa_year-year + 1.

APPEND l_wa_year TO l_i_year.

ENDDO.

SORT l_i_year BY key .

LOOP AT l_i_year INTO l_wa_year.

l_wa_region-value = l_wa_year-year .

l_wa_region-key = l_wa_year-key.

APPEND l_wa_region TO l_i_beyear.

ENDLOOP.

Thanks,

kris.

Edited by: kissnas on Oct 21, 2010 7:53 AM

Former Member
0 Kudos

Hi Kris

Take one node:DATENODE (0..n) with attribute date type string.

In layout take DDBI and bind the texts property to date attribute

in WDOinit method copy hte below code..

data:

l_wa_year1 TYPE i,

node TYPE REF TO if_wd_context_node,

l_i_year type wd_this->elements_datenode,

l_wa_year TYPE wd_this->element_datenode.

node = wd_context->get_child_node( 'DATENODE').

l_wa_year1 = sy-datum+0(4) - 39 .

DO 39 TIMES.

l_wa_year1 = l_wa_year1 + 1.

l_wa_year-date = l_wa_year1.

APPEND l_wa_year TO l_i_year.

ENDDO.

SORT l_i_year DESCENDING.

node->bind_table( l_i_year ).

let me know if you have any doubts

Thanks and Regards

Tulasi Palnati

Former Member
0 Kudos

Hi Tulasi,

The year field is one of the attribute in my node, i am using this year field as one of the column in table ui element.

and i am using DDBY KEY...

complete code is :

l_wa_year-key = sy-datum+0(4) - 39 .

l_wa_year-year = sy-datum+0(4) - 39 .

DO 39 TIMES.

  • L_V_YEAR1 = L_V_YEAR1 - 1 .

l_wa_year-key = l_wa_year-key + 1.

  • l_wa_year-key = L_V_YEAR1.

l_wa_year-year = l_wa_year-year + 1.

APPEND l_wa_year TO l_i_year.

  • l_v_year = l_v_year - 1.

ENDDO.

SORT l_i_year BY key .

LOOP AT l_i_year INTO l_wa_year.

l_wa_region-value = l_wa_year-year .

l_wa_region-key = l_wa_year-key.

APPEND l_wa_region TO l_i_beyear.

ENDLOOP.

  • set single attribute

lr_nodeinfo_flightinfo->set_attribute_value_set(

name = `BEYEAR`

value_set = l_i_beyear ).

  • set single attribute

lr_nodeinfo_flightinfo->set_attribute_value_set(

name = `ENYEAR`

value_set = l_i_beyear ).

Thanks,

kris.

Edited by: kissnas on Oct 21, 2010 8:58 AM

Former Member
0 Kudos

Hi Kris

1.by using method set_attribute_value_set( ) we cannot sort the data descending.

2.Try to use DropDOwnByINDex in the table ui elemnt

2.check this article

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c03227f9-e48f-2c10-4bad-8ebdec704f3d

Edited by: Tulasi Palnati on Oct 21, 2010 9:39 AM