Application Development and Automation 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: 
Read only

listbox values

Former Member
0 Likes
541

hi,

how can i pass values to a list box with user defined type in a report?

5 REPLIES 5
Read only

Former Member
0 Likes
520

Hi

See the sample code

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.

Reward points for useful Answers

Regards

Anji

Read only

kiran_k8
Active Contributor
0 Likes
520

Type-pools:vrm.

Use the Function Module VRM_GET_VALUES

REPORT ZSCRATCHPAD .

type-pools:vrm.

PARAMETER : p_int AS LISTBOX VISIBLE LENGTH 30.

DATA : name TYPE vrm_id,

list TYPE vrm_values,

value LIKE LINE OF list.

AT SELECTION-SCREEN OUTPUT.

name = 'P_INT'.

value-key = '1'.

value-text = 'Pavan'.

APPEND value TO list.

value-key = '2'.

value-text = 'Jawahar'.

APPEND value TO list.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list.

CLEAR list.

K.Kiran.

Read only

Former Member
0 Likes
520

thanx kiran and anji reddy.i have one more query.

when i select one of the values in the list box and exeecute how can i jump to the next screen based on the value selected?

Read only

kiran_k8
Active Contributor
0 Likes
520

Pavan,

validate by writing an IF condition like this,for ex.

if itab-vrm = 'PAWAN'.

CALL VA01 AND SKIP FIRST SCREEN.

ELSE.

CALL VA02 AND SKIP FIRST SCREEN.

ENDIF.

K.Kiran.

Read only

Former Member
0 Likes
520

Hi,

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 10.

AT SELECTION-SCREEN OUTPUT.

  • 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.

  • Here you need to select the values based on the text field

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Don't forget to reward if useful...