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: 

how to get drop down menu

Former Member
0 Kudos
77

hai plz help me

how to dovelop a drop down menu for a field in selection screen

5 REPLIES 5

former_member182485
Active Contributor
0 Kudos
49

Hi,

Plese refer this pice of code

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-015.

PARAMETERS: p_bp_ty(10) AS LISTBOX VISIBLE LENGTH 15 OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

TYPES: BEGIN OF vrm_value,

key(40) TYPE c,

text(80) TYPE c,

END OF vrm_value.

DATA: param(80) TYPE c,

values TYPE vrm_value,

it_values TYPE STANDARD TABLE OF vrm_value,

wa_value TYPE vrm_value.

param = 'p_bp_ty'.

"Assigning a key to each drop down value

wa_value-key = '1'.

wa_value-text = 'Premium value'.

APPEND wa_value TO it_values.

CLEAR wa_value.

wa_value-key = '2'.

wa_value-text = 'High value'.

APPEND wa_value TO it_values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = param

values = it_values

.

Reward if helpful.

Regards

Bikas

Former Member
0 Kudos
49

Hi

Hope it will help you.

Pls reward if help.

REPORT zwa_test2.

TYPE-POOLS : vrm.

tables: bkpf.

DATA : values TYPE vrm_values.

DATA : wa LIKE LINE OF values.

PARAMETERS : list_box(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.

PARAMETERS: dd type bkpf-BSTAT user-command abc.

select-options: a for bkpf-bukrs MODIF ID buk.

select-options: b for bkpf-belnr MODIF ID SEL.

at selection-screen output.

If list_box = 2.

loop at screen.

if screen-group1 = 'SEL'.

screen-input = 0.

modify screen.

endif.

endloop.

endif.

INITIALIZATION.

wa-key = '1'.

wa-text = 'Orange'.

APPEND wa TO values.

wa-key = '2'.

wa-text = 'Red'.

APPEND wa TO values.

wa-key = '3'.

wa-text = 'Blue'.

APPEND wa TO values.

wa-key = '4'.

wa-text = 'Gray'.

APPEND wa TO values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'LIST_BOX'

values = values

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

Ref Program: DEMO_DROPDOWN_LIST_BOX

Link:

Former Member
0 Kudos
49

you need to call the VRM_SET_VALUES function module....passing the values to be displayed as an internal table....

Former Member
0 Kudos
49

you can test this simple prg:

REPORT ZTESTKOD1 .

TYPE-POOLS: VRM.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

PARAMETERS: PS_PARM(10) AS LISTBOX VISIBLE LENGTH 20.

AT SELECTION-SCREEN OUTPUT.

refresh list.

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.

CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

-


reward if its helpful

link: [Abap Tips & Notes|abap4beginner.blogspot.com]

former_member226203
Active Contributor
0 Kudos
49

Hi,

First declare Type-pools: VRM.

BEGIN OF vrm_value,

key(40) TYPE c,

text(80) TYPE c,

END OF vrm_value.

DATA : it_values TYPE TABLE OF vrm_value,

wa_values2 TYPE vrm_value.

*Declare the field for which you want the dropdown.

c_fieldname TYPE vrm_id VALUE 'tablename-fieldname'.

Using a select query selct the values into an internal table (it_tab) that are to be displayed in the dropdown.

REFRESH it_values.

  • Loop on the Internal table it_tab to get values.

LOOP AT it_tab INTO wa_tab .

wa_values-key = wa_tab-z_fieldname.

APPEND wa_values TO it_values.

CLEAR: wa_values,

wa_tab .

ENDLOOP.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = c_fieldname

values = it_values[]

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.