‎2009 May 07 8:24 AM
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.
‎2009 May 07 8:33 AM
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.
‎2009 May 07 8:28 AM
HI,
try like this:
PARAMETERS: ps_parm AS LISTBOX VISIBLE LENGTH 10
Kiran
‎2009 May 07 8:33 AM
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.
‎2009 May 07 8:35 AM
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.
‎2009 Jun 08 7:48 AM
Is ur problem solved..?
If so..please let me know the solution..I'm facing the same ...
regards,
usha.
‎2009 Jun 08 8:00 AM
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.