cancel
Showing results for 
Search instead for 
Did you mean: 

Action on drop down box which is created dynamically

Former Member
0 Kudos

Hi Gurus,

I have created a drop down box dynamically with fixed values using add_parameter_field. Now i want is when user selects particular value from the drop down box few fields should be disabled on the screen. Can you please help how to do this. i have added the code below

l_defdate_range-key = '1'."'01DAY'.

l_defdate_range-value = 'Yesterday'.

APPEND l_defdate_range TO lt_defdate_range.

l_defdate_range-key = '2'."'15DAY'.

l_defdate_range-value = 'Since 15 Days'.

APPEND l_defdate_range TO lt_defdate_range.

l_defdate_range-key = '3'."'30DAY'.

l_defdate_range-value = 'Since 30 Days'.

APPEND l_defdate_range TO lt_defdate_range.

l_defdate_range-key = '4'."'MONTH'.

l_defdate_range-value = 'Last Month'.

APPEND l_defdate_range TO lt_defdate_range.

*--Default date range

wd_this->m_handler->add_parameter_field(

i_id = 'P_DEF_DT_RANGE'

i_description = 'Default date range'

it_value_set = lt_defdate_range

i_as_dropdown = abap_true

i_within_block = 'DATES'

i_value = l_value ).

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member199125
Active Contributor
0 Kudos

Hi vickyachu2004

First bind an attribute ( of wdy_boolean type) to enable property of all fields ( which u want to disable ) on screen.

now use the conditiona validation.

For expample if dropdown value is equal to 1000

then

set above attribute to invisible ( 02 ).

Hope u understand the above logic. if not pls reply back with quiries

Regards

Srinivas

Answers (3)

Answers (3)

Former Member
0 Kudos

HI kris,

Your answer is very helpful and it even works. But my problem is slight different. You code works when i select the value and press enter key. But what i want it as soon as user selects the value from the drop down it should disable the fields.

Thaks for your reply

Former Member
0 Kudos

Hi Vicky,

For dropdown you will find onselect event. In that write your code to disable it will works.

kindly paste your code, and details

Cheers,

Kris.

Former Member
0 Kudos

Hi Vicky,

Create one attribute of type WDY_BOOLEAN and bind these fields to enable property of those fields which youw ant to disable.

Go to OnSelect Event of drop down write code.

First get the value selected from drop down. like..

DATA : lv_dropdown type string . // To store drop down value. you can take type as you required

  • get all declared attributes

lo_el_segment1->get_static_attributes(

IMPORTING

static_attributes = ls_segment1 ).

lv_dropdown = ls_segment1-segment. // Now dropdown value is in lv_dropdown.

if lv_dropdown = 1.

  • set single attribute

lo_el_input->set_attribute(

name = `SHIP_POINT` // your Attribute name

value =ABAP_FALSE ).

Endif.

Cheers,

Kris.

Lukas_Weigelt
Active Contributor
0 Kudos

Hi,

1. Get a global reference of the View Interface via WDDOMODIFY view and write it to a global attribute

2. Downcast the UI-Tree for the UI-element you want to alter

3. make an instance for the WDUI-Type you want to alter (type ref to cl_wd_<xxx>)

4. use the respective method to alter the UI-element according to your needs

regards, Lukas