BASIS--使用DELETE_USER_ON_DB批量删除用户
REPORT ZDELUSER.
TABLES: USR01, USR02, *USR02, USR04, *USR04.
TABLES: USR03, USR05, USGRP, USR08, USR09, USR30.
TABLES: USR10, USR11, USR12, *USR10, *USR12, USR13, *USR13, USR16.
TABLES: USH04, USH10, USH12, USH02.
TABLES: UST04, UST10C, UST10S, UST12.
TABLES: USRBF.
PARAMETER UGRP LIKE USR03-CLASS.
DATA: BEGIN OF INTUSR02 OCCURS 200,
BNAME LIKE USR02-BNAME,
END OF INTUSR02.
DATA: CNTR TYPE P VALUE 0.
SELECT * FROM USR02 WHERE CLASS = UGRP.
INTUSR02-BNAME = USR02-BNAME.
APPEND INTUSR02.
ENDSELECT.
LOOP AT INTUSR02.
CALL FUNCTION 'DELETE_USER_ON_DB'
EXPORTING USER = INTUSR02-BNAME
EXCEPTIONS OTHERS = 1.
CNTR = CNTR + 1.
ENDLOOP.
WRITE : / 'Users deleted ', CNTR.
TABLES: USR01, USR02, *USR02, USR04, *USR04.
TABLES: USR03, USR05, USGRP, USR08, USR09, USR30.
TABLES: USR10, USR11, USR12, *USR10, *USR12, USR13, *USR13, USR16.
TABLES: USH04, USH10, USH12, USH02.
TABLES: UST04, UST10C, UST10S, UST12.
TABLES: USRBF.
PARAMETER UGRP LIKE USR03-CLASS.
DATA: BEGIN OF INTUSR02 OCCURS 200,
BNAME LIKE USR02-BNAME,
END OF INTUSR02.
DATA: CNTR TYPE P VALUE 0.
SELECT * FROM USR02 WHERE CLASS = UGRP.
INTUSR02-BNAME = USR02-BNAME.
APPEND INTUSR02.
ENDSELECT.
LOOP AT INTUSR02.
CALL FUNCTION 'DELETE_USER_ON_DB'
EXPORTING USER = INTUSR02-BNAME
EXCEPTIONS OTHERS = 1.
CNTR = CNTR + 1.
ENDLOOP.
WRITE : / 'Users deleted ', CNTR.