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

default value in a list box

Former Member
0 Likes
1,520

How can we set a mandatory and default value for list box.

How can we set a mandatory and default value for list box.

5 REPLIES 5
Read only

Former Member
0 Likes
826

Hi,

is it dialog programming screen or in report selection-screen..

Thanks,

Naren

Read only

0 Likes
826

report selection screen

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

even called the function VRM_SET_VALUES just want to make it mandatory and set the first value as the default value.

Read only

Former Member
0 Likes
826

Hi,

Check this example..

TYPE-POOLS: vrm.

PARAMETERS: p_test TYPE char4 AS LISTBOX VISIBLE LENGTH 10.

DATA: t_data TYPE vrm_values.

INITIALIZATION.

DATA: s_data TYPE vrm_value.

s_data-key = 'ABCD'.

s_data-text = 'First four'.

APPEND s_data TO t_data.

s_data-key = 'EFGHI'.

s_data-text = 'Second four'.

APPEND s_data TO t_data.

<b>* Set the default value.

READ TABLE t_data INTO s_data INDEX 1.

p_test = s_data-key.</b>

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_TEST'

values = t_data

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.

<b>AT SELECTION-SCREEN.

IF p_test IS INITIAL.

MESSAGE e208(00) WITH 'Parameter mandatory'.

ENDIF.</b>

START-OF-SELECTION.

WRITE: / p_test.

THanks,

Naren

Read only

0 Likes
826

for defaulting a value you cansimply use

PARAMETERS : A(10) TYPE c AS LISTBOX VISIBLE LENGTH 10 DEFAULT 'A' .

(where A is the key of the entry in values list)

Regards

Raja

Read only

0 Likes
826

Hi,

Module pool programming:

Directly hot code the list box name = 'default value' at PBO event.

Report programming:

PARAMETERS : LIST(10) TYPE C AS LISTBOX VISIBLE LENGTH 20 DEFAULT 'XYZ' .