1 REPORT y4_b4_test41.
2
3 *PARAMETERS:p_prog like trdir-name .
4
5 DATA:gr_scan TYPE REF TO cl_ci_scan,
6 gr_source TYPE REF TO cl_ci_source_include,
7 gs_stat LIKE LINE OF gr_scan->statements,
8 gs_token LIKE LINE OF gr_scan->tokens,
9 gt_token TYPE stokesx_tab,
10 gs_message TYPE char255,
11 gt_message LIKE TABLE OF gs_message,
12 gs_if TYPE char255,
13 gt_if LIKE TABLE OF gs_if,
14 lv_flag TYPE n,
15 lv_index TYPE sy-index.
16
17 gr_source = cl_ci_source_include=>create( p_name = 'Y4_B4_TEST42' ) .
18
19 CREATE OBJECT gr_scan
20 EXPORTING
21 p_include = gr_source.
22
23 LOOP AT gr_scan->statements INTO gs_stat .
24
25 REFRESH gt_token .
26 CLEAR lv_index .
27
28 LOOP AT gr_scan->tokens INTO gs_token FROM gs_stat-from TO gs_stat-to .
29
30 lv_index = lv_index + 1 .
31 APPEND gs_token TO gt_token .
32
33 ENDLOOP .
34
35 "判断SELECT *
36 READ TABLE gt_token TRANSPORTING NO FIELDS WITH KEY str = 'SELECT' .
37 IF sy-subrc = 0 .
38
39 CLEAR gs_token .
40 READ TABLE gt_token INTO gs_token INDEX 2 .
41 IF gs_token-str = '*' .
42 CLEAR gs_message .
43 gs_message = '第' && gs_token-row && '行有SELECT * ' .
44 APPEND gs_message TO gt_message .
45 ENDIF .
46
47 ENDIF .
48
49 "判断DELETE标准表
50 READ TABLE gt_token TRANSPORTING NO FIELDS WITH KEY str = 'DELETE' .
51 IF sy-subrc = 0 .
52
53 CLEAR gs_token .
54 READ TABLE gt_token INTO gs_token INDEX 2 .
55 IF gs_token-str+0(1) <> 'Z' .
56 CLEAR gs_message .
57 gs_message = '第' && gs_token-row && '行有DELETE标准表' .
58 APPEND gs_message TO gt_message .
59 ENDIF .
60
61 ENDIF .
62
63 "判断UPDATE标准表
64 READ TABLE gt_token TRANSPORTING NO FIELDS WITH KEY str = 'UPDATE' .
65 IF sy-subrc = 0 .
66
67 CLEAR gs_token .
68 READ TABLE gt_token INTO gs_token INDEX 2 .
69 IF gs_token-str+0(1) <> 'Z' .
70 CLEAR gs_message .
71 gs_message = '第' && gs_token-row && '行有UPDATE标准表' .
72 APPEND gs_message TO gt_message .
73 ENDIF .
74
75 ENDIF .
76
77 ENDLOOP .
78
79 LOOP AT gt_message INTO gs_message .
80 WRITE gs_message .
81 ENDLOOP .