Code: Alles auswählen.
method RUN.
data:
L_INCLUDE type SOBJ_NAME,
L_LAST_INCLUDE type SOBJ_NAME,
L_ROW type TOKEN_ROW,
L_COLUMN type TOKEN_COL,
L_KEYWORD type STRING,
L_CNT type I,
L_CNT_INCLUDE type I,
L_CNT_CHAR type C length 20,
L_CNT_CHAR_INCLUDE type C length 20,
L_FROM type I,
L_TO type I.
check PROGRAM_NAME is not initial.
if REF_SCAN is initial.
check GET( ) = 'X'.
endif.
check REF_SCAN->SUBRC = 0.
L_CNT = 0.
*-- loop at all tokens
loop at REF_SCAN->STATEMENTS into STATEMENT_WA.
check STATEMENT_WA-FROM <= STATEMENT_WA-TO.
*-- avoid unexpanded MAKROS
check STATEMENT_WA-TYPE ne 'M'.
L_KEYWORD = KEYWORD( ).
*-- WRITE ---------------------------------------------------------
if L_KEYWORD = 'WRITE'.
*-----exclude 'WRITE ... TO'
L_FROM = STATEMENT_WA-FROM + 2.
L_TO = STATEMENT_WA-TO - 1.
if L_FROM <= L_TO.
loop at REF_SCAN->TOKENS into TOKEN_WA
from L_FROM to L_TO.
if TOKEN_WA-STR = 'TO'.
exit.
endif.
endloop.
endif.
check TOKEN_WA-STR ne 'TO'.
write: 'JAAAA'.
add 1 to L_CNT. add 1 to L_CNT_INCLUDE.
*--- show every single WRITE
if P_SHOW = 'X'.
L_INCLUDE = GET_INCLUDE( ).
GET_LINE_COLUMN_REL( exporting P_N = 1
importing P_LINE = L_ROW
P_COLUMN = L_COLUMN ).
INFORM( P_SUB_OBJ_TYPE = C_TYPE_INCLUDE
P_SUB_OBJ_NAME = L_INCLUDE
* P_POSITION =
P_LINE = L_ROW
P_COLUMN = L_COLUMN
P_TEST = C_MY_NAME
P_CODE = '0002'
* P_SUPPRESS =
* P_PARAM_1 =
* P_PARAM_2 =
* P_PARAM_3 =
* P_PARAM_4 =
).
*--- only show first WRITE of every INCLUDE
endif.
if P_SUM_INCLUDES = 'X'.
L_INCLUDE = GET_INCLUDE( ).
GET_LINE_COLUMN_REL( exporting P_N = 1
importing P_LINE = L_ROW
P_COLUMN = L_COLUMN ).
if L_INCLUDE ne L_LAST_INCLUDE and
L_LAST_INCLUDE is not initial.
L_CNT_INCLUDE = L_CNT_INCLUDE - 1.
move L_CNT_INCLUDE to L_CNT_CHAR_INCLUDE.
L_CNT_INCLUDE = 1.
INFORM( P_SUB_OBJ_TYPE = C_TYPE_INCLUDE
P_SUB_OBJ_NAME = L_LAST_INCLUDE
* P_POSITION =
P_LINE = L_ROW
P_COLUMN = L_COLUMN
P_TEST = C_MY_NAME
P_CODE = '0003'
* P_SUPPRESS =
P_PARAM_1 = L_LAST_INCLUDE
P_PARAM_2 = L_CNT_CHAR_INCLUDE
* P_PARAM_3 =
* P_PARAM_4 =
).
endif.
L_LAST_INCLUDE = L_INCLUDE.
endif.
endif.
endloop.
*--- show only total number of WRITEs
if P_SHOW ne 'X' and P_SUM_INCLUDES ne 'X'.
move L_CNT to L_CNT_CHAR.
INFORM(
P_SUB_OBJ_TYPE = 'PROG'
P_SUB_OBJ_NAME = PROGRAM_NAME
* P_POSITION = L_POSITION
* P_LINE = L_ROW
* P_COLUMN = L_COLUMN
P_TEST = C_MY_NAME
P_CODE = '0001'
* P_SUPPRESS =
P_PARAM_1 = PROGRAM_NAME
P_PARAM_2 = L_CNT_CHAR
* P_PARAM_3 =
* P_PARAM_4 =
).
endif.
if P_SUM_INCLUDES = 'X' and L_CNT_INCLUDE ne 0.
* L_INCLUDE = GET_INCLUDE( ).
move L_CNT_INCLUDE to L_CNT_CHAR_INCLUDE.
INFORM( P_SUB_OBJ_TYPE = C_TYPE_INCLUDE
P_SUB_OBJ_NAME = L_LAST_INCLUDE
* P_POSITION =
P_LINE = L_ROW
P_COLUMN = L_COLUMN
P_TEST = C_MY_NAME
P_CODE = '0003'
* P_SUPPRESS =
P_PARAM_1 = L_LAST_INCLUDE
P_PARAM_2 = L_CNT_CHAR_INCLUDE
* P_PARAM_3 =
* P_PARAM_4 =
).
endif.
endmethod.
Code: Alles auswählen.
METHOD keyword.
IF statement_wa-type = 'C'.
p_result = 'COMPUTE'.
RETURN.
ENDIF.
READ TABLE ref_scan->tokens INDEX statement_wa-from INTO token_wa.
p_result = token_wa-str.
ENDMETHOD.