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

List Box in Selection Screen

Former Member
0 Likes
2,394

Hi Gyes,

In executable report selection screen,i want to list box in ranges(for examole from to to).

Thanks & regards,

Suresh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,471

Hi suresh,

Use selection-screen begin of line ...

end of line

Just try this code (with standard table fields )

type-pools: vrm.

data:

IT_LIST TYPE VRM_VALUES," table to store values of listbox

*--Structure declaration

WA_LIST LIKE LINE OF IT_LIST,

*--Variable declaration

V_NAME1 TYPE VRM_ID. " to store Id of Value Set

selection-screen begin of line.

SELECTION-SCREEN COMMENT 1(20) text-001 FOR FIELD v_vbeln1.

parameters: v_vbeln1 type vbap-vbeln AS LISTBOX VISIBLE LENGTH 13.

SELECTION-SCREEN COMMENT 40(20) text-002 FOR FIELD v_vbeln2.

parameters:v_vbeln2 type vbap-vbeln AS LISTBOX VISIBLE LENGTH 13.

selection-screen end of line.

*--populating the values for the list box

WA_LIST-TEXT = '0000000011'.

WA_LIST-KEY = '0000000011'.

APPEND WA_LIST TO IT_LIST.

CLEAR WA_LIST.

WA_LIST-TEXT = '0000000012'.

WA_LIST-KEY = '0000000012'.

APPEND WA_LIST TO IT_LIST.

CLEAR WA_LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = V_NAME1

VALUES = IT_LIST.

Default vbelns in vbap get populated if we do not populate explicitly and declare as

p_vbeln type vbap-vbeln.

No values get populated if we declare as

p_vbeln type vbeln.

Regards,

Vidya.

Hi Gyes,

In executable report selection screen,i want to list box in ranges(for examole from to to).

Thanks & regards,

Suresh

10 REPLIES 10
Read only

Former Member
0 Likes
1,471

Cant we use <b>Select-options</b> for this.

Read only

0 Likes
1,471

Parameter is it possible?

Read only

Former Member
0 Likes
1,471

Hi Suresh,

For list box try this

*--Table declaration

IT_LIST TYPE VRM_VALUES," table to store values of listbox

*--Structure declaration

WA_LIST LIKE LINE OF IT_LIST,

*--Variable declaration

V_NAME TYPE VRM_ID. " to store Id of Value Set

AT SELECTION-SCREEN OUTPUT.

V_NAME = 'P_ZPPUOM'.

*--populating the values for the list box

WA_LIST-TEXT = 'P'.

WA_LIST-KEY = 'P'.

APPEND WA_LIST TO IT_LIST.

CLEAR WA_LIST.

WA_LIST-TEXT = 'H'.

WA_LIST-KEY = 'H'.

APPEND WA_LIST TO IT_LIST.

CLEAR WA_LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = V_NAME

VALUES = IT_LIST.

and in the selection-screen declare the parameter as

parameters: P_ZPPUOM TYPE ZPP_MP_UOM AS LISTBOX VISIBLE LENGTH 4."UOM

Regards,

Vidya

Read only

0 Likes
1,471

Hi Vidya,

I want from and to option.

Plwase give me any standard table refrence name.

parameters: P_ZPPUOM TYPE ZPP_MP_UOM AS LISTBOX VISIBLE LENGTH 4."UOM

Thanks,

Suresh

Read only

0 Likes
1,471

I Believe, you can use LIST BOX option only for PARAMETERS.

if you want a range, you can use 2 PARAMETERS Adjacent to one another.

regards

srikanth

Read only

0 Likes
1,471

Hi srikanth,

How can i use 2 PARAMETERS Adjacent to one another.

Thanks,

Sursesh

Read only

0 Likes
1,471

Check the below program,

i have used 2 parameters for this purpose & placed them on the same line.

give some text to TEXT-001

PROGRAM zlist.

TYPE-POOLS : VRM.

DATA: param TYPE vrm_id,

values TYPE vrm_values,

value LIKE LINE OF values.

selection-screen begin of line.

SELECTION-SCREEN COMMENT 3(10) TEXT-001.

PARAMETERS: p_name(5) AS LISTBOX VISIBLE LENGTH 10.

PARAMETERS: p_name2(5) AS LISTBOX VISIBLE LENGTH 10.

selection-screen end of line.

AT SELECTION-SCREEN OUTPUT.

param = 'P_NAME'.

value-key = '1'.

value-text = 'JOHN'.

APPEND value TO values.

value-key = '2'.

value-text = 'PETER'.

APPEND value TO values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = param

values = values.

REFRESH VALUES.

param = 'P_NAME2'.

value-key = '1'.

value-text = 'NAME2'.

APPEND value TO values.

value-key = '2'.

value-text = 'NAME3'.

APPEND value TO values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = param

values = values.

START-OF-SELECTION.

WRITE 😕 'HELO'.

Regards

srikanth

Read only

Former Member
0 Likes
1,471

check this link, may be helpful for your requirement.

here is the code copied from the above post,

PROGRAM zlist.

TYPE-POOLS : VRM.

DATA: param TYPE vrm_id,

values TYPE vrm_values,

value LIKE LINE OF values.

PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

param = 'P_NAME'.

value-key = '1'.

value-text = 'JOHN'.

APPEND value TO values.

value-key = '2'.

value-text = 'PETER'.

APPEND value TO values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = param

values = values.

regards

srikanth

Read only

Former Member
0 Likes
1,472

Hi suresh,

Use selection-screen begin of line ...

end of line

Just try this code (with standard table fields )

type-pools: vrm.

data:

IT_LIST TYPE VRM_VALUES," table to store values of listbox

*--Structure declaration

WA_LIST LIKE LINE OF IT_LIST,

*--Variable declaration

V_NAME1 TYPE VRM_ID. " to store Id of Value Set

selection-screen begin of line.

SELECTION-SCREEN COMMENT 1(20) text-001 FOR FIELD v_vbeln1.

parameters: v_vbeln1 type vbap-vbeln AS LISTBOX VISIBLE LENGTH 13.

SELECTION-SCREEN COMMENT 40(20) text-002 FOR FIELD v_vbeln2.

parameters:v_vbeln2 type vbap-vbeln AS LISTBOX VISIBLE LENGTH 13.

selection-screen end of line.

*--populating the values for the list box

WA_LIST-TEXT = '0000000011'.

WA_LIST-KEY = '0000000011'.

APPEND WA_LIST TO IT_LIST.

CLEAR WA_LIST.

WA_LIST-TEXT = '0000000012'.

WA_LIST-KEY = '0000000012'.

APPEND WA_LIST TO IT_LIST.

CLEAR WA_LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = V_NAME1

VALUES = IT_LIST.

Default vbelns in vbap get populated if we do not populate explicitly and declare as

p_vbeln type vbap-vbeln.

No values get populated if we declare as

p_vbeln type vbeln.

Regards,

Vidya.

Read only

Former Member
0 Likes
1,471

REPORT zes_sample.

TYPE-POOLS: vrm.

TABLES:mara.

PARAMETERS: p_matnr AS LISTBOX VISIBLE LENGTH 6.

DATA values TYPE vrm_values WITH HEADER LINE.

*AT SELECTION-SCREEN OUTPUT.

INITIALIZATION.

SELECT * FROM mara.

values-text = mara-matnr.

values-key = mara-matnr.

APPEND values.

ENDSELECT.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_MATNR'

values = values[]

  • EXCEPTIONS

  • ID_ILLEGAL_NAME = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.