You are on page 1of 2

*&---------------------------------------------------------------------*

*& Report ZP54


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZP54.
SELECTION-SCREEN begin of block bk1 with frame title t1.
SELECTION-SCREEN begin of line.
*parameter P_course type c as LISTBOX. "syntax error "the list box can only be used
with vissible length"
SELECTION-SCREEN COMMENT 8(20) lb1.
parameter P_course type c as LISTBOX visible length 20.
SELECTION-SCREEN end of line.
selection-screen skip 2.
SELECTION-SCREEN begin of line.
SELECTION-SCREEN PUSHBUTTON 20(15) b1 USER-COMMAND fc1.
data : t_value type table of vrm_value,
wa_value type vrm_value.
selection-screen end of line.
SELECTION-SCREEN end of block bk1.

INITIALIZATION.
lb1 = 'COURSE'.
t1 = 'Select Course which you want'.
b1 = 'Identify'.
perform preparedropdown.
if t_value is not initial. "not empty

perform displaydropdown.
endif.
*AT SELECTION-SCREEN.
* case sy-ucomm.
* when 'FC1'.
* if P_course = 'K1'.
* MESSAGE 'you have selected Core Abap.' type 'I'.
* elseif P_course = 'K2'.
* MESSAGE 'you have selected OOPS Abap.' type 'I'.
* elseif P_course = 'K3'.
* MESSAGE 'you have selected Cross Apps.' type 'I'.
* else.
* MESSAGE 'none selected.' type 'I'.
* endif.
* endcase.
FORM PREPAREDROPDOWN .

clear wa_value.
wa_value-key = 'K1'.
wa_value-Text = 'Core Abap'.
append wa_value to t_value.

clear wa_value.
wa_value-key = 'K2'.
wa_value-Text = 'OOPS Abap'.
append wa_value to t_value.
clear wa_value.
wa_value-key = 'K3'.
wa_value-Text = 'Cross Apps'.
append wa_value to t_value.
ENDFORM. " PREPAREDROPDOWN

FORM DISPLAYDROPDOWN .
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'P_course'
VALUES = t_value
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
if sy-subrc eq 1.
message 'illegal dropdown listbox name.' type 'I'.
elseif sy-subrc eq 2.
message 'Unknown error' type 'I'.
endif.

ENDFORM. " DISPLAYDROPDOWN

You might also like