REPORT TEST
.
TYPE-POOLS
:vrm
.
DATA
: name
TYPE vrm_id
.
DATA
:num
TYPE
i
.
“根据PRODH字段长度判断 某行属于哪一级
DATA
:loaded
TYPE
c LENGTH
1
.
“控制不重复查询数据库和不反复append数据 to WA1[]
TYPES
:
BEGIN
OF wa
,
key
(
40
)
,
text
(
80
)
TYPE
c
,
END
OF wa
.
DATA
:
gt
LIKE t179t
OCCURS
0
WITH
HEADER
LINE
.
DATA
:wa1
TYPE
TABLE
OF wa
WITH
HEADER
LINE
.
“111
DATA
:wa2
TYPE
TABLE
OF wa
WITH
HEADER
LINE
.
“111222
DATA
:wa3
TYPE
TABLE
OF wa
WITH
HEADER
LINE
.
“111222333
DATA
:itab
LIKE t179t
OCCURS
0
WITH
HEADER
LINE
.
DATA
: ps_t
(
15
)
TYPE
c
.
SELECTION-SCREEN
BEGIN
OF
BLOCK t1
WITH
FRAME
TITLE
TEXT
–
001
.
SELECTION-SCREEN
BEGIN
OF
LINE
.
SELECTION-SCREEN
COMMENT
1
(
31
)
TEXT
–
003
.
PARAMETERS
: pl1
LIKE ps_t
AS LISTBOX VISIBLE LENGTH
15
USER-COMMAND p1
.
“一级类
SELECTION-SCREEN
END
OF
LINE
.
SELECTION-SCREEN
SKIP
1
.
SELECTION-SCREEN
BEGIN
OF
LINE
.
SELECTION-SCREEN
COMMENT
1
(
31
)
TEXT
–
004
.
PARAMETERS
: pl2
LIKE ps_t
AS LISTBOX VISIBLE LENGTH
15
USER-COMMAND p2
.
“二级类
SELECTION-SCREEN
END
OF
LINE
.
SELECTION-SCREEN
SKIP
1
.
SELECTION-SCREEN
BEGIN
OF
LINE
.
SELECTION-SCREEN
COMMENT
1
(
31
)
TEXT
–
005
.
PARAMETERS
: pl3
LIKE ps_t
AS LISTBOX VISIBLE LENGTH
15
.
“三级类
SELECTION-SCREEN
END
OF
LINE
.
SELECTION-SCREEN
END
OF
BLOCK t1
.
INITIALIZATION
.
AT
SELECTION-SCREEN
OUTPUT
.
name
=
‘PL1’
.
IF loaded
IS
INITIAL
.
gt
–prodh
=
‘00001’
.
gt
–vtext
=
‘服务器’
.
append
gt
.
clear
gt
.
gt
–prodh
=
‘0000100001’
.
gt
–vtext
=
‘服务器00001’
.
append
gt
.
clear
gt
.
gt
–prodh
=
‘000010000100000001’
.
gt
–vtext
=
‘服务器0000100000001’
.
append
gt
.
clear
gt
.
gt
–prodh
=
‘000010000100000002’
.
gt
–vtext
=
‘服务器0000100000002’
.
append
gt
.
clear
gt
.
gt
–prodh
=
‘00002’
.
gt
–vtext
=
‘PC’
.
append
gt
.
clear
gt
.
gt
–prodh
=
‘0000200001’
.
gt
–vtext
=
‘PC0000200001’
.
append
gt
.
clear
gt
.
gt
–prodh
=
‘000020000100000001’
.
gt
–vtext
=
‘PC000020000100000001’
.
append
gt
.
clear
gt
.
gt
–prodh
=
‘000020000100000002’
.
gt
–vtext
=
‘PC000020000100000002’
.
append
gt
.
clear
gt
.
loaded
=
‘X’
.
LOOP
AT
gt
.
num
=
strlen
(
gt
–prodh
)
.
IF num
=
5
.
wa1
–
text
=
gt
–vtext
.
“Description
wa1
–
key
=
gt
–prodh
.
“Product hierarchy key field
APPEND
: wa1
.
ENDIF
.
CLEAR
:
gt
,num
,wa1
.
“CLEAR 清空WA1工作区,不清空WA1[]内表
ENDLOOP
.
ENDIF
.
CALL
FUNCTION
‘VRM_SET_VALUES’
EXPORTING
id
= name
values
= wa1[]
.
AT
SELECTION-SCREEN
.
CASE sy
–ucomm
.
WHEN
‘P1’
.
CLEAR
: pl2
,pl3
.
“清空2、3级下拉空默认值,当用户在选择屏幕上重新选择时需要清除
CLEAR
:wa2
,wa2[]
.
“清空2级下拉内表对应的值,当用户在选择屏幕上重新选择时需要清除
CLEAR num
.
LOOP
AT
gt
.
num
=
strlen
(
gt
–prodh
)
.
IF num
=
10
AND
gt
–prodh+0
(
5
)
= pl1
.
wa2
–
text
=
gt
–vtext
.
wa2
–
key
=
gt
–prodh
.
APPEND
: wa2
.
ENDIF
.
CLEAR
:
gt
,num
,wa2
.
ENDLOOP
.
CALL
FUNCTION
‘VRM_SET_VALUES’
EXPORTING
id
=
‘PL2’
values
= wa2[]
.
CLEAR pl2
.
WHEN
‘P2’
.
CLEAR pl3
.
“清空3级下拉空默认值,当用户在选择屏幕上重新选择时需要清除
CLEAR
:wa3
,wa3[]
.
“清空3级下拉内表对应的值,当用户在选择屏幕上重新选择时需要清除
CLEAR num
.
LOOP
AT
gt
.
num
=
strlen
(
gt
–prodh
)
.
IF num
=
18
AND
gt
–prodh+0
(
10
)
= pl2
.
wa3
–
text
=
gt
–vtext
.
wa3
–
key
=
gt
–prodh
.
APPEND
: wa3
.
ENDIF
.
CLEAR
:
gt
,num
,wa3
.
ENDLOOP
.
CALL
FUNCTION
‘VRM_SET_VALUES’
EXPORTING
id
=
‘PL3’
values
= wa3[]
.
CLEAR pl3
.
ENDCASE
.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/20122.html