Register Login

How to add drop down option for the field with multiple values in the module pool program.

Updated May 18, 2018

See the program and do accordingly
Input : p_char = 'J'.
Press: enter
List Box of Month = January, June , July.

REPORT ZLIST_VALUES.
TYPE-POOLS vrm.
tables:
spfli.
parameters: p_char type c.

parameters:
p_month(12) as listbox visible length 20,
p_year as listbox visible length 20 .

DATA:
t_table TYPE STANDARD TABLE OF vrm_value,
t_table1 TYPE STANDARD TABLE OF vrm_value,

vrm_values1 LIKE LINE OF t_table.

DATA:
t_year TYPE STANDARD TABLE OF vrm_value.

data: w_year(4) type n value '2000'.

*****************
at selection-screen output.

vrm_values1-key = 'a'.
vrm_values1-text = 'January'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'p'.
vrm_values1-text = 'February'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'q'.
vrm_values1-text = 'March'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'r'.
vrm_values1-text = 'April'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 's'.
vrm_values1-text = 'May'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 't'.
vrm_values1-text = 'June'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'u'.
vrm_values1-text = 'July'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'v'.
vrm_values1-text = 'August'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'w'.
vrm_values1-text = 'September'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'x'.
vrm_values1-text = 'October'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'y'.
vrm_values1-text = 'November'.
APPEND vrm_values1 TO t_table.

vrm_values1-key = 'z'.
vrm_values1-text = 'December'.
APPEND vrm_values1 TO t_table.

t_table1[] = t_table.

delete t_table1 where text+0(1) <> p_char.

CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_month'
values = t_table1
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.

do 10 times.
add 1 to w_year.
vrm_values1-key = sy-index.
vrm_values1-text = w_year.
APPEND vrm_values1 TO t_year.
enddo.

CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_year'
values = t_year
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.

start-of-selection.

write: p_month.


×