如果想checkbox每次选择起到控制作用
PARAMETERS: p_cb1 TYPE c AS CHECKBOX DEFAULT 'X' USER-COMMAND check,
必须设置这个user-command 必须设置,后面的名字无所谓
REPORT zlm_checkbox_04.
TYPE-POOLS
:
vrm
.
"存放combobox内容的type
pool
DATA
:
name
TYPE
vrm_id
,
"list
box的名称
list
TYPE
vrm_values
,
"list
box的值
value
LIKE
LINE
OF
list
.
"list
box的结构
*定义checkbox,指定command,为了能够响应选择屏幕中值的改变
PARAMETERS
:
p_cb1
TYPE
c
AS
CHECKBOX
DEFAULT
'X'
USER-COMMAND
check
,
"必须设置这个user-command
p_cb2
TYPE
c
AS
CHECKBOX
DEFAULT
'X'
USER-COMMAND
check
.
*定义listbox,必须指定visible
length
PARAMETERS
:
p_list1
(
10
)
TYPE
c
AS
LISTBOX
VISIBLE
LENGTH
15
,
p_list2
(
20
)
TYPE
c
AS
LISTBOX
VISIBLE
LENGTH
25
.
*开始执行
AT
SELECTION-SCREEN
OUTPUT
.
PERFORM
zform_int
.
PERFORM
zform_seletc
.
*&---------------------------------------------------------------------*
*&
Form
zform_seletc
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM
zform_seletc
.
IF
p_cb1
=
''
.
CLEAR
:
p_list1
.
LOOP
AT
SCREEN
.
IF
screen
-name
=
'P_LIST1'
.
screen
-
input
=
0
.
MODIFY
SCREEN
.
ENDIF
.
ENDLOOP
.
ENDIF
.
IF
p_cb2
=
''
.
.
LOOP
AT
SCREEN
.
IF
screen
-name
=
'P_LIST2'
.
screen
-
input
=
0
.
MODIFY
SCREEN
.
ENDIF
.
ENDLOOP
.
ENDIF
.
ENDFORM
.
"zform_seletc
*&---------------------------------------------------------------------*
*&
Form
zform_int
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM
zform_int
.
*向listbox里面添加值
REFRESH
list
.
value
-
key
=
'1'
.
"这个就是变量P_LIST的值
value
-
text
=
'一'
.
"这个是text
APPEND
value
TO
list
.
value
-
key
=
'2'
.
value
-
text
=
'二'
.
APPEND
value
TO
list
.
*调用函数显示listbox里面的值
CALL
FUNCTION
'VRM_SET_VALUES'
EXPORTING
id
=
'P_LIST1'
values
=
list
.
REFRESH
list
.
value
-
key
=
'A'
.
value
-
text
=
'啊'
.
APPEND
value
TO
list
.
value
-
key
=
'O'
.
value
-
text
=
'哦'
.
APPEND
value
TO
list
.
CALL
FUNCTION
'VRM_SET_VALUES'
EXPORTING
id
=
'P_LIST2'
values
=
list
.
ENDFORM
.
"zform_int