Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

dropdown 2 value change based on the dropdown 1 value selected?

Former Member
0 Kudos

HI all,

I have 2 dropdown fields in my module pool program. Based on the value selected from 1st dropdown, the values for the second dropdown should be changed dynamically. So, values for second dropdown is dynamically changed based on the value selected in first dropdown. I dont want to perform any other action (any button click, etc) for this change to happen.

Can someone tell me in which module i need to write the logic, so that the values for second dropdown will be automatically changed based on the option selected in first dropdown.

1 ACCEPTED SOLUTION

former_member184578
Active Contributor
0 Kudos

Hi jessica,

You need to write coding obviously in PAI. before that you need to assign function code for your first dropdown. To do so go to layout of the screen, select your first dropdown and select attributes and add function code to that, let say DRP1,

Now in your PAI,

if sy-ucomm = 'DRP1'

read the drop down 1 value

based on that populate internal table of second drop down

pass the populated internal table to vrm_set_values FM of drp down 2

endif.

Hope this helps,

For further clarifications, revert back.

Thanks & Regards,

Kiran.

6 REPLIES 6

former_member184578
Active Contributor
0 Kudos

Hi jessica,

You need to write coding obviously in PAI. before that you need to assign function code for your first dropdown. To do so go to layout of the screen, select your first dropdown and select attributes and add function code to that, let say DRP1,

Now in your PAI,

if sy-ucomm = 'DRP1'

read the drop down 1 value

based on that populate internal table of second drop down

pass the populated internal table to vrm_set_values FM of drp down 2

endif.

Hope this helps,

For further clarifications, revert back.

Thanks & Regards,

Kiran.

0 Kudos

Hi,

I have created a custom infotype through PM01. I have few issues in the display of the screen fields. That is, I have to display a screen field in disable mode. I have selected the "input not possible" option for that field. Still that field is displayed in Enable mode only when viewed in PA30 tcode.

There are some defualt values in the Screen group1 and group3 values. Thats is, all fields has GROUP1 as 006 and GROUP3 as 001, 002, 003, etc.

Is there anyting to do with screen group of the fields,

could someone help me, why these screen fields are not displayed in disable mode, even after changing the property of the screen field?

0 Kudos

Hi,

Now the values in second dropdown dynamically gets changed based on the value selected in dropdown 1. Now i have one more issue. That is, whenever i select a new value in dropdown 1, the previous values in dropdown 2 gets refreshed and new values gets populated. From the new set of values, the user will select one value from dropdown 2.

The issue is, along with the new set of values, the single value which the user selected from dropdown 2 also gets included. I m clearing the old value which the user selected from dropdown (clear : P9001-RESSUBTYPE) before appending the new internal table set to dropdown 2. But still, the previous value which got selected is also added in dropdown 2.

Could someone help me why the old value is also coming and how to resolve this issue?

Edited by: Jessica Rose on Feb 7, 2012 6:31 AM

0 Kudos

Hi Jessica,

Apart from clearing field P9001-RESSUBTYPE, clear your internal table which you are passing to vrm set values FM. and then append the internal table with new values.

else.

after using clear P9001-RESSUBTYPE statement, use DYNP_VALUES_UPDATE FM and check.

Hope this helps u.,

Thanks & Regards,

Kiran.

0 Kudos

Hello Jessica

Apart from clearing the work area you may need to refresh the internal table for DD2 .

Thanks

Nilesh P

rajeevgoswami1
Participant
0 Kudos

Hi Jessica,

For Dropdown list its recommended to write code in POV (Process on value-request) Module

Eg.

PROCESS ON VALUE-REQUEST.

FIELD <FIELD_NAME1> MODULE <MODULE_NAME1>.

FIELD <FIELD_NAME2> MODULE <MODULE_NAME2>.

For Dropdown list you can refer ABAP DOCU program DEMO_DROPDOWN_LIST_BOX.

For your scenario assign Fcode to first DD list at screen layout level so that PAI and other events will trigger when you select entries in list box, and in second module(for DD list 2) besed on entry in first DD list insert values for second dd list.

I hope it will solve ur issue.

If you have any other queries please let me know.

Regards,

Rajeev Goswami

YASH Technologies

Edited by: rajeevgoswami1 on Feb 4, 2012 10:29 PM