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

Drop Down In Selection Screen Field

Former Member
0 Likes
725

Hi experts,

I have an requirement to add Drop Down in one of my Selection Screen Field. This field is for Status where the values are stored in short text manner like R,M etc. In Drop Down I have to define the Abbreviation for these . Please if anybody can help me through code or options for the same.

Thanks in Advance.

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
674

Hi,

type-pools: vrm.

data: it_val type vrm_values,

w_line like line of it_val.

parameters p_stat as listbox

visible length 1 obligatory.

initialization.

w_line-key = '1'.

w_line-text = 'A'.

append w_line to it_val.

w_line-key = '2'.

w_line-text = 'B'.

append w_line to it_val.

at selection-screen output.

call function 'VRM_SET_VALUES'

exporting

id = 'P_STAT'

values = it_val.

end-of-selection.

write: / p_stat.

5 REPLIES 5
Read only

Former Member
0 Likes
674

HI,

try like this:

PARAMETERS: ps_parm AS LISTBOX VISIBLE LENGTH 10

Kiran

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
675

Hi,

type-pools: vrm.

data: it_val type vrm_values,

w_line like line of it_val.

parameters p_stat as listbox

visible length 1 obligatory.

initialization.

w_line-key = '1'.

w_line-text = 'A'.

append w_line to it_val.

w_line-key = '2'.

w_line-text = 'B'.

append w_line to it_val.

at selection-screen output.

call function 'VRM_SET_VALUES'

exporting

id = 'P_STAT'

values = it_val.

end-of-selection.

write: / p_stat.

Read only

Former Member
0 Likes
674

take this example


PARAMETERS: P_YEAR(8) AS LISTBOX VISIBLE LENGTH 8.



AT SELECTION-SCREEN OUTPUT ."ON P_YEAR  .

NAME = 'P_YEAR'.
VALUE-KEY = 'A'.
VALUE-TEXT = '2008'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'B'.
VALUE-TEXT = '2009'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'C'.
VALUE-TEXT = '2010'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'D'.
VALUE-TEXT = '2011'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'E'.
VALUE-TEXT = '2012'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'F'.
VALUE-TEXT = '2013'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'G'.
VALUE-TEXT = '2014'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'H'.
VALUE-TEXT = '2015'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'I'.
VALUE-TEXT = '2016'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'J'.
VALUE-TEXT = '2017'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'K'.
VALUE-TEXT = '2018'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'L'.
VALUE-TEXT = '2019'.
APPEND VALUE TO LIST.

NAME = 'P_YEAR'.
VALUE-KEY = 'M'.
VALUE-TEXT = '2020'.
APPEND VALUE TO LIST.



CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    ID                    = NAME
    VALUES                = LIST
 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.

Read only

Former Member
0 Likes
674

Is ur problem solved..?

If so..please let me know the solution..I'm facing the same ...

regards,

usha.

Read only

0 Likes
674

Hi Usha,

I have solved my problem and the answer is in this blog itself. You can also do this :

type-pools: vrm.

data: it_val type vrm_values,

w_line like line of it_val.

parameters p_stat as listbox

visible length 1 obligatory.

initialization.

w_line-key = '1'.

w_line-text = 'A'.

append w_line to it_val.

w_line-key = '2'.

w_line-text = 'B'.

append w_line to it_val.

at selection-screen output.

call function 'VRM_SET_VALUES'

exporting

id = 'P_STAT'

values = it_val.

This is the right code sent by Jayanthi for this issue.