report zab_ssdemo1.
"parameter without any typing (1 character)
parameters: p_name.
"will be shown as checkbox
parameters: p_name1 as checkbox .
*"Radiobuton parameter, there must be at least two of them
parameters: p_name2 radiobutton group rb1.
*"second one is set as defaulty set
parameters: p_name3 radiobutton group rb1 default 'X'.
*"parameter with ditctionary type
parameters: p_carrid type scarr-carrid.
**"parameter with dynamic type
data: g_paramname(60) type c.
parameters: p_dynami like (g_paramname).
"parameter with ditctionary with value check
parameters: p_curr1 type scarr-currcode value check.
*"obligatory parameter
parameters: p_carri1 type scarr-carrid obligatory.
*"hidden parameter
parameters: p_carri2 type scarr-carrid no-display.
*"parameter with memory id
parameters: p_carri3 type char3 memory id car.
*"string parameter with field lenght set
parameters: p_strin1 type string visible length 15 default 'aaaa'.
*"string parameter with field lenght set and in lower case
parameters: p_strin2 type string visible length 15 lower case default 'aaaa'.
*"parameter with modify group
parameters: p_carri4 type scarr-carrid modif id gr1.
*"listbox parameter
parameters: p_name4 type char2 as listbox visible length 25 modif id gr1.
*"listobx parameter with user-command
parameters: p_name5 type char2 as listbox visible length 25 user-command lbchange.
*"parameter with matchcode object
parameters: p_name6 type char2 matchcode object h_t002.
*
*
"event at each output of selection screen
at selection-screen output.
"loop at screen elements
loop at screen.
"if we find elements of our group
if screen-group1 eq 'GR1'.
"then change the font color
screen-intensified = 1.
modify screen.
endif.
endloop.
*
*"events at user-command
at selection-screen.
"if the listobox has changed
if sy-ucomm eq 'LBCHANGE'.
"check if fields are same
if p_name5 = p_name4.
"if yes then throw put a cursor on P_NAME5 and show message
set cursor field 'P_NAME4'.
message w001(00) with 'P_NAME5 should be different than P_NAME4'.
endif.
endif.
initialization.
g_paramname = 'SFLIGHT-CARRID'.
* "fill listboxes at initialization of program
perform set_listbox_values.
*
*
start-of-selection.
break-point.
*
**&---------------------------------------------------------------------*
**& Form set_listbox_values
**&---------------------------------------------------------------------*
*
form set_listbox_values.
type-pools: vrm.
data: f_name type vrm_id.
data: ft_values type vrm_values.
data: fs_values like line of ft_values.
f_name = 'P_NAME4'. "parameter name
fs_values-key = 'K1'. "key is the value that will be passed to parameter
fs_values-text = 'Text of K1'. "descritpion of paramter shown in listbox
append fs_values to ft_values.
fs_values-key = 'K2'.
fs_values-text = 'Text of K2'.
append fs_values to ft_values.
fs_values-key = 'K3'.
fs_values-text = 'Text of K3'.
append fs_values to ft_values.
fs_values-key = 'K4'.
fs_values-text = 'Text of K4'.
append fs_values to ft_values.
call function 'VRM_SET_VALUES'
exporting
id = f_name
values = ft_values
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
f_name = 'P_NAME5'.
call function 'VRM_SET_VALUES'
exporting
id = f_name
values = ft_values
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
endform. "set_listbox_values
Selection Screen - Part1 - Parameters
Today, as a first entry in Beginners part I'd like you to show how to build parameters on selection screen. All this information you can find under F1 help but here you've got visualization of what's written there. Hope it will help to understand this statement. As embed video is my first one then please accept my apologies in case of errors and wrong pronunciations as English is not my native language.
You can look on the example bellow or importi it to your SAP system from .nugg file.