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: 

Dynamic dropdown list

Former Member
0 Kudos

Hi experts,

Kindly solve my requirement.

There are 3 radio buttons R1, R2, R3.

i have a dropdown box with 2 values for a parameter in the selection screen.

When i select the first value , the radio button R1 & R2 should display in the selection screen and

when i select the second value ,the radio button R3 should display in the selection screen.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Hope this code will meet ur requirement.

&----


*& Report Z_TEST2

*&

&----


*&

*&

&----


REPORT z_test2.

TYPE-POOLS: vrm.

DATA: name TYPE vrm_id, list TYPE vrm_values, value LIKE LINE OF list.

TABLES: sscrfields.

PARAMETERS: ps_parm AS LISTBOX VISIBLE LENGTH 10

USER-COMMAND abc.

PARAMETERS: rb1 RADIOBUTTON GROUP ab MODIF ID bl2,

rb2 RADIOBUTTON GROUP ab MODIF ID bl2,

rb3 RADIOBUTTON GROUP ab MODIF ID bl3.

INITIALIZATION.

name = 'PS_PARM'.

value-key = '1'. value-text = 'Line 1'. APPEND value TO list.

value-key = '2'. value-text = 'Line 2'. APPEND value TO list.

AT SELECTION-SCREEN OUTPUT.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list.

LOOP AT SCREEN.

IF ps_parm = 1.

IF screen-name = 'RB1' or screen-name = 'RB2' .

screen-invisible = 0.

elseif screen-name = 'RB3'.

screen-invisible = 1.

ENDIF.

MODIFY SCREEN.

elseIF ps_parm = 2.

IF screen-name = 'RB1' or screen-name = 'RB2' .

screen-invisible = 1.

elseif screen-name = 'RB3'.

screen-invisible = 0.

ENDIF.

MODIFY SCREEN.

endif.

ENDLOOP.

AT SELECTION-SCREEN.

IF sscrfields-ucomm = 'ABC'.

ENDIF.

START-OF-SELECTION.

WRITE: / 'Parameter:', ps_parm.

Regards,

joy.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Pls check the lionk below:

http://sap.niraj.tripod.com/id38.html

Hope this helps.

Regards,

Sharath

Former Member
0 Kudos

Plz dont send the link..

Thanks.

Former Member
0 Kudos

u just put a user-command UCOMM for the list output....

after this in at selection screen output... u made invisible the radio buttons u required...

Former Member
0 Kudos

hi pridarshan,

USE FM CALL FUNCTION 'VRM_SET_VALUES'

see below code

Please refer the code below:

PARAMETERS:

listbox(1) AS LISTBOX VISIBLE LENGTH 10 DEFAULT 'N'.

AT SELECTION-SCREEN OUTPUT.

DATA:

name TYPE vrm_id,

list TYPE vrm_values,

value TYPE vrm_value.

name = 'LISTBOX'. " Name should be in UPPER CASE

value-key = '1'.

value-text = 'Text 1'.

APPEND value TO list.

value-key = '2'.

value-text = 'Text 2'.

APPEND value TO list.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list

EXCEPTIONS

id_illegal_name = 0

OTHERS = 0.

Thanks,

Reward Point

Former Member
0 Kudos

Hi,

Hope this code will meet ur requirement.

&----


*& Report Z_TEST2

*&

&----


*&

*&

&----


REPORT z_test2.

TYPE-POOLS: vrm.

DATA: name TYPE vrm_id, list TYPE vrm_values, value LIKE LINE OF list.

TABLES: sscrfields.

PARAMETERS: ps_parm AS LISTBOX VISIBLE LENGTH 10

USER-COMMAND abc.

PARAMETERS: rb1 RADIOBUTTON GROUP ab MODIF ID bl2,

rb2 RADIOBUTTON GROUP ab MODIF ID bl2,

rb3 RADIOBUTTON GROUP ab MODIF ID bl3.

INITIALIZATION.

name = 'PS_PARM'.

value-key = '1'. value-text = 'Line 1'. APPEND value TO list.

value-key = '2'. value-text = 'Line 2'. APPEND value TO list.

AT SELECTION-SCREEN OUTPUT.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list.

LOOP AT SCREEN.

IF ps_parm = 1.

IF screen-name = 'RB1' or screen-name = 'RB2' .

screen-invisible = 0.

elseif screen-name = 'RB3'.

screen-invisible = 1.

ENDIF.

MODIFY SCREEN.

elseIF ps_parm = 2.

IF screen-name = 'RB1' or screen-name = 'RB2' .

screen-invisible = 1.

elseif screen-name = 'RB3'.

screen-invisible = 0.

ENDIF.

MODIFY SCREEN.

endif.

ENDLOOP.

AT SELECTION-SCREEN.

IF sscrfields-ucomm = 'ABC'.

ENDIF.

START-OF-SELECTION.

WRITE: / 'Parameter:', ps_parm.

Regards,

joy.