参考了SE30,测量运行时间里面的一些代码.
REPORT ZTEST .
DATA: PROG TYPE STRING,
FULL TYPE STANDARD TABLE OF STRING,
WA TYPE STRING,
TAB TYPE STANDARD TABLE OF STRING,
MESS TYPE STRING,
SID TYPE STRING.
CALL FUNCTION 'TERM_CONTROL_EDIT'
EXPORTING
TITEL = '请输入要执行的SQL语句'
TABLES
TEXTLINES = TAB
EXCEPTIONS
USER_CANCELLED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF LINES( TAB ) > 0 .
APPEND 'Report zdynamic_sql message-id 00.' TO FULL.
APPEND 'Form execute.' TO FULL.
LOOP AT TAB INTO WA.
APPEND WA TO FULL.
ENDLOOP.
APPEND 'if sy-subrc = 0.' TO FULL.
APPEND 'message I018.' TO FULL.
APPEND 'else.' TO FULL.
APPEND 'MESSAGE I667.' TO FULL.
APPEND 'endif.' TO FULL.
APPEND 'Endform.' TO FULL.
GENERATE SUBROUTINE POOL FULL NAME PROG MESSAGE MESS SHORTDUMP-ID SID.
IF SY-SUBRC = 0.
PERFORM ('EXECUTE') IN PROGRAM (PROG) IF FOUND.
ELSEIF SY-SUBRC = 4.
MESSAGE MESS TYPE 'I'.
ELSEIF SY-SUBRC = 8.
MESSAGE SID TYPE 'I'.
ENDIF.
ENDIF.
ENDIF.
阅读(918) | 评论(0) | 转发(0) |