*&---------------------------------------------------------------------*
*& Title: deleting tables ACCT* *
*&---------------------------------------------------------------------*
REPORT ZZTTAMAC.
TABLES:
ACCTHD, ACCTIT, ACCTCR.
CONSTANTS:
PACKAGE_SIZE TYPE I VALUE 1000000.
"核心关键点在这里,此处是调整一次性删除多少数据,这个值我的系统的极值点,
"如果你想使用,请自己去调整这个数值,系统原来的默认值是1000
DATA:
ACCTHD_KEY_TAB LIKE ACCHD_KEY OCCURS PACKAGE_SIZE WITH HEADER LINE,
ACCTIT_KEY_TAB LIKE ACCIT_KEY OCCURS PACKAGE_SIZE WITH HEADER LINE.
DATA:
BEGIN OF ACCTCR_KEY_TAB OCCURS PACKAGE_SIZE.
INCLUDE STRUCTURE ACCCR_KEY.
DATA:
WAERS LIKE ACCTCR-WAERS,
END OF ACCTCR_KEY_TAB,
DEL_COUNT TYPE I.
PARAMETERS: P_TEST AS CHECKBOX DEFAULT 'X'.
* Delete table ACCTHD completely
CLEAR DEL_COUNT.
IF P_TEST IS INITIAL.
DO.
* for runtime-estimations only: Just check how long 1000 deletes
* would take via taking off the asterix of the following line
* and commenting off the latter one:
* DO 1 TIMES.
*
SELECT MANDT
AWTYP
AWREF
AWORG
FROM ACCTHD
INTO TABLE ACCTHD_KEY_TAB
UP TO PACKAGE_SIZE ROWS.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
DELETE ACCTHD FROM TABLE ACCTHD_KEY_TAB.
COMMIT WORK.
DEL_COUNT = DEL_COUNT + SY-DBCNT.
REFRESH ACCTHD_KEY_TAB.
CLEAR ACCTHD_KEY_TAB.
ENDDO.
WRITE: / 'Table ACCTHD: ', DEL_COUNT, ' records deleted'.
ELSE.
SELECT COUNT(*) FROM ACCTHD INTO DEL_COUNT.
WRITE: / 'Table ACCTHD: ', DEL_COUNT, ' records read'.
ENDIF.
* DELETE TABLE ACCTIT COMPLETELY
CLEAR DEL_COUNT.
IF P_TEST IS INITIAL.
DO.
* for runtime-estimations only: Just check how long 1000 deletes
* would take via taking off the asterix of the following line
* and commenting off the latter one:
* DO 1 TIMES.
*
SELECT MANDT
AWTYP
AWREF
AWORG
POSNR
FROM ACCTIT
INTO TABLE ACCTIT_KEY_TAB
UP TO PACKAGE_SIZE ROWS.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
DELETE ACCTIT FROM TABLE ACCTIT_KEY_TAB.
COMMIT WORK.
DEL_COUNT = DEL_COUNT + SY-DBCNT.
REFRESH ACCTIT_KEY_TAB.
CLEAR ACCTIT_KEY_TAB.
ENDDO.
WRITE: / 'Table ACCTIT: ', DEL_COUNT, ' records deleted'.
ELSE.
SELECT COUNT(*) FROM ACCTIT INTO DEL_COUNT.
WRITE: / 'Table ACCTIT: ', DEL_COUNT, ' records read'.
ENDIF.
* Delete table ACCTCR completely
CLEAR DEL_COUNT.
IF P_TEST IS INITIAL.
DO.
* for runtime-estimations only: Just check how long 1000 deletes
* would take via taking off the asterix of the following line
* and commenting off the latter one:
* DO 1 TIMES.
*
SELECT MANDT
AWTYP
AWREF
AWORG
POSNR
CURTP
WAERS
FROM ACCTCR
INTO TABLE ACCTCR_KEY_TAB
UP TO PACKAGE_SIZE ROWS.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
DELETE ACCTCR FROM TABLE ACCTCR_KEY_TAB.
COMMIT WORK.
DEL_COUNT = DEL_COUNT + SY-DBCNT.
REFRESH ACCTCR_KEY_TAB.
CLEAR ACCTCR_KEY_TAB.
ENDDO.
WRITE: / 'Table ACCTCR: ', DEL_COUNT, ' records deleted'.
ELSE.
SELECT COUNT(*) FROM ACCTCR INTO DEL_COUNT.
WRITE: / 'Table ACCTCR: ', DEL_COUNT, ' records read'.
ENDIF.
快速删除acctit表中数据
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 题目:已知长度为n的顺序表A,请写出删除该表中数据信息为item的数据元素。解题思路1:简单粗暴法,从表中的第1个...
- 题目:删除线性链表中数据域值为item的所有链结点解题思路:先从链表的第2个链结点开始,从前往后依次判断链表中所有...