Mass clean up program for non production database size reduction

For production systems you need to be very careful running clean up programs. When you want to clean up data there, it does take time to do proper analysis and do it carefully.

When you have a sandbox, development or test system, launching and planning all the diverse clean up programs can take quite some time. Even more time than the storage gain.

Solution: install below Z mass clean up program.

Install and run this program at your own risk! 

The program will trigger several clean up programs. If you want to change anything: you can do so at your own risk.

There are 2 built-in failsafes:

  1. Authorization check for NADM (basis admin)
  2. Check not to run in production system (based on SCC4 client settings)

After the initial clean up program in batch, the next run is scheduled automatically.

Objects, Programs, job frequency and references:

ObjectProgram(s)Job frequencyReference
Table loggingRSTBPDELDailyTable logging
IdocsRSETESTD
RSRLDREL
RSRLDREL2
Hourly
Daily
Daily
Idocs
Application logsSBAL_DELETEDailyGeneral technical clean up
WorkflowsRSWWWIDEDailyGeneral technical clean up
SAP OfficeRSBCS_REORG
RSBCS_ADRVP
RSBCS_SREQ_EXPIRE
RSBCS_SREQ_INITIAL_RELEASE
RSBCS_DELETE_QUEUE
RSSODFRE
RSSO_DELETE_PRIVATE
RSGOSRE02
Daily
Daily
Daily
Daily
Daily
Daily
Daily
Daily
Deleting SAP office documents
Old RFC dataRSARFCER
RSTRFCES
Daily
Daily
General technical clean up
Change documentsRSCDOK99DailyGeneral technical clean up
Change pointersRBDCPCLR2DailyChange pointers
ABAP where usedRS_DEL_WBCROSSGT
SAPRSEUB
Only onceGeneral technical clean up and ABAP where used index
Old batch jobsRSBTCDEL2DailyGeneral technical clean up
Saved listsRSAQQLRE_MASSDailyTable AQLDB clean up
BW loggingRSDDSTAT_DATA_DELETE
RSBATCH_DEL_MSG_PARM_DTPTEMP
RSPM_HOUSEKEEPING
RSBKCLEANUPBUFFER
ODQ_CLEANUP
Daily
Daily
Daily
Daily
Technical clean up for BI

*&---------------------------------------------------------------------*
*& Report ZMASSCLEANUP
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zmasscleanup.

DATA(zlv_fcode) = 'NADM'. "authorization check object
DATA: zls_t000 TYPE t000.

DATA:
zlt_params TYPE TABLE OF rsparams,
zls_param TYPE rsparams.
DATA zlv_variant_text TYPE varid.
DATA zls_vari_text TYPE varit.
DATA zlt_vari_text TYPE TABLE OF varit.

PARAMETERS: p_cl TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_cld TYPE i DEFAULT '365'.
PARAMETERS: p_id TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_idd TYPE i DEFAULT '365'.
PARAMETERS: p_al TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_ald TYPE i DEFAULT '365'.
PARAMETERS: p_wi TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_wid TYPE i DEFAULT '365'.
PARAMETERS: p_so TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_sod TYPE i DEFAULT '365'.
PARAMETERS: p_rf TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_rfd TYPE i DEFAULT '7'.
PARAMETERS: p_cd TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_cdd TYPE i DEFAULT '365'.
PARAMETERS: p_cp TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_cpd TYPE i DEFAULT '365'.
PARAMETERS: p_sl TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_sld TYPE i DEFAULT '365'.
PARAMETERS: p_bj TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_bwd TYPE i DEFAULT '30'.
PARAMETERS: p_bw TYPE char1 DEFAULT ' ' AS CHECKBOX .
PARAMETERS: p_bjd TYPE i DEFAULT '7'.
PARAMETERS: p_vh TYPE char1 DEFAULT ' ' AS CHECKBOX .

INITIALIZATION.
%_p_cl_%_app_%-text = 'Delete table change logging'.
%_p_cld_%_app_%-text = 'Days to keep table change logging'.
%_p_id_%_app_%-text = 'Delete Idocs'.
%_p_idd_%_app_%-text = 'Days to keep idocs'.
%_p_al_%_app_%-text = 'Delete application logs'.
%_p_ald_%_app_%-text = 'Days to keep application'.
%_p_wi_%_app_%-text = 'Delete Workflow items'.
%_p_wid_%_app_%-text = 'Days to keep Workflows'.
%_p_so_%_app_%-text = 'Delete SAP office items'.
%_p_sod_%_app_%-text = 'Days to keep SAP office items'.
%_p_rf_%_app_%-text = 'Delete old RFC data'.
%_p_rfd_%_app_%-text = 'Days to keep old RFC data'.
%_p_cd_%_app_%-text = 'Delete old Change Documents'.
%_p_cdd_%_app_%-text = 'Days to keep old Change Documents'.
%_p_cp_%_app_%-text = 'Delete old Change Pointers'.
%_p_cpd_%_app_%-text = 'Days to keep old Change Pointers'.
%_p_sl_%_app_%-text = 'Delete old Saved lists'.
%_p_sld_%_app_%-text = 'Days to keep old Saved lists'.
%_p_bj_%_app_%-text = 'Delete old batch jobs'.
%_p_bjd_%_app_%-text = 'Days to keep old batch jobs'.
%_p_bw_%_app_%-text = 'Delete old BW jobs'.
%_p_bwd_%_app_%-text = 'Days to keep old BW jobs'.
%_p_vh_%_app_%-text = 'WBCROSSGT table clean up'.

START-OF-SELECTION.

* check for basis adminstration access
AUTHORITY-CHECK OBJECT 'S_ADMI_FCD'
ID 'S_ADMI_FCD' FIELD zlv_fcode.

IF sy-subrc = 0.
"User has administration authorization for that function

* Fetch the client properties
SELECT SINGLE * FROM t000 INTO zls_t000 WHERE mandt = sy-mandt.
IF zls_t000-cccategory = 'P'.
* Forbid to run on productive client
WRITE: / 'Do not run on productive client: Productive (Production client)'.
ELSE.
IF p_cl EQ 'X'.
PERFORM cleanup_table_change_log USING p_cld.
ENDIF.
IF p_id EQ 'X'.
PERFORM cleanup_idocs USING p_idd.
ENDIF.
IF p_al EQ 'X'.
PERFORM cleanup_application_logs USING p_ald.
ENDIF.
IF p_wi EQ 'X'.
PERFORM cleanup_workflows USING p_wid.
ENDIF.
IF p_so EQ 'X'.
PERFORM cleanup_sapoffice USING p_sod.
ENDIF.
IF p_rf EQ 'X'.
PERFORM cleanup_rfcdata USING p_rfd.
ENDIF.
IF p_cd EQ 'X'.
PERFORM cleanup_changedocuments USING p_cdd.
ENDIF.
IF p_cp EQ 'X'.
PERFORM cleanup_changepointers USING p_cpd.
ENDIF.
IF p_bj EQ 'X'.
PERFORM cleanup_batchjobs USING p_bjd.
ENDIF.
IF p_sl EQ 'X'.
PERFORM cleanup_savedlists USING p_sld.
ENDIF.
IF p_bw EQ 'X'.
PERFORM cleanup_bwlogs USING p_bwd.
ENDIF.
IF p_vh EQ 'X'.
PERFORM cleanup_wbcrossgt USING p_cdd.
ENDIF.
ENDIF.

ELSE.
"No authorization
MESSAGE e398(00) WITH |No admin authorization (S_ADMI_FCD={ zlv_fcode })|.
ENDIF.
*&---------------------------------------------------------------------*
*& Form start_job
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM start_job
USING
ziv_progname TYPE progname
ziv_variant TYPE raldb_vari
ziv_timing TYPE char1.

DATA: ziv_jobname TYPE tbtcjob-jobname.
DATA: zcv_jobcount TYPE tbtcjob-jobcount.
DATA: zlv_prddays TYPE tbtcjob-prddays.
DATA: zlv_prdhours TYPE tbtcjob-prdhours.

ziv_jobname = ziv_progname+0(32).

"-------------------------------
" 1) Open job
"-------------------------------
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = ziv_jobname
IMPORTING
jobcount = zcv_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.

"-------------------------------
" 2) Add step (program + variant)
"-------------------------------
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
jobname = ziv_jobname
jobcount = zcv_jobcount
authcknam = sy-uname
report = ziv_progname
variant = ziv_variant
language = sy-langu
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg = 9
OTHERS = 10.

IF sy-subrc <> 0.
"Best-effort cleanup: close job without releasing it

CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobname = ziv_jobname
jobcount = zcv_jobcount
strtimmed = space
EXCEPTIONS
OTHERS = 1.

MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.

"-------------------------------
" 3) Close job and start immediately
"-------------------------------

IF ziv_timing EQ 'D'.
zlv_prddays = 1.
zlv_prdhours = 0.

ELSEIF ziv_timing EQ 'H'.
zlv_prddays = 0.
zlv_prdhours = 1.
ELSEIF ziv_timing EQ 'X'. "run only once
zlv_prddays = 0.
zlv_prdhours = 0.
ENDIF.

CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobname = ziv_jobname
jobcount = zcv_jobcount
prddays = zlv_prddays
prdhours = zlv_prdhours
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.

WRITE: / 'Job',ziv_jobname, zcv_jobcount,' scheduled:', ziv_progname, ziv_variant, 'immediate'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form create_variant
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM create_variant
TABLES zit_params
USING
ziv_report TYPE progname
ziv_variant TYPE raldb_vari.

REFRESH zlt_vari_text.

zlv_variant_text-report = ziv_report.
zlv_variant_text-variant = ziv_variant.
zlv_variant_text-environmnt = 'A'.
zls_vari_text-vtext = zlv_variant_text.
zls_vari_text-report = ziv_report.
zls_vari_text-variant = ziv_variant.
APPEND zls_vari_text TO zlt_vari_text.

CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = ziv_report
curr_variant = ziv_variant
vari_desc = zlv_variant_text
TABLES
vari_contents = zit_params
vari_text = zlt_vari_text
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 8
OTHERS = 9.

IF sy-subrc = 0.
WRITE: / 'Variant created:', ziv_report, ziv_variant.
ELSE.
WRITE: / 'Variant creation failed. SY-SUBRC=', sy-subrc.
ENDIF.

ENDFORM.

*&---------------------------------------------------------------------*
*& Form cleanup_table_change_log
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM cleanup_table_change_log USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.

CLEAR zls_param.
REFRESH zlt_params.
zls_param-selname = 'P_DAYS'. " amount of days to keep
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSTBPDEL' zlv_variant.
PERFORM start_job USING 'RSTBPDEL' zlv_variant 'D'.

ENDFORM.

*&---------------------------------------------------------------------*
*& Form cleanup_idocs
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_IDD
*&---------------------------------------------------------------------*
FORM cleanup_idocs USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.
zls_param-selname = 'GP_TEST'. " test flag to be removed
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_COM'. " commit counter
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = '100'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'GP_MAXCT'. " max amount of idocs
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = '1000000'.
APPEND zls_param TO zlt_params.


zls_param-selname = 'GS_CREDA'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.


PERFORM create_variant TABLES zlt_params USING 'RSETESTD' zlv_variant.
PERFORM start_job USING 'RSETESTD' zlv_variant 'H'.

CLEAR zls_param.
REFRESH zlt_params.

zlv_date = sy-datum - 9999.
zls_param-selname = 'G_DSINCE'. " start date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zlv_date = sy-datum - ziv_days.
zls_param-selname = 'G_DUNTIL'. " to date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zls_param-selname = 'G_TABLE'. " table
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'IDOCREL'.
APPEND zls_param TO zlt_params.


PERFORM create_variant TABLES zlt_params USING 'RSRLDREL2' zlv_variant.
PERFORM start_job USING 'RSRLDREL2' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zlv_date = sy-datum - 9999.
zls_param-selname = 'G_DSINCE'. " start date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zlv_date = sy-datum - ziv_days.
zls_param-selname = 'G_DUNTIL'. " to date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zls_param-selname = 'G_OBJTYP'. " table
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'IDOC'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'G_NONE'. " no existance check
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'G_PKSZ'. " package size
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 250.
APPEND zls_param TO zlt_params.

zls_param-selname = 'G_CTSZ'. " package size
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 250.
APPEND zls_param TO zlt_params.

PERFORM create_variant TABLES zlt_params USING 'RSRLDREL' zlv_variant.
PERFORM start_job USING 'RSRLDREL' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_application_logs
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_ALD
*&---------------------------------------------------------------------*
FORM cleanup_application_logs USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.
zls_param-selname = 'P_BEF_OK'. " delete all logs
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_BCK'. " schedule background jobs
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zlv_date = sy-datum - 9999.
zls_param-selname = 'P_BEGDAT'. " start date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zlv_date = sy-datum - ziv_days.
zls_param-selname = 'P_ENDDAT'. " end date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'SBAL_DELETE' zlv_variant.
PERFORM start_job USING 'SBAL_DELETE' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_workflows
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_WID
*&---------------------------------------------------------------------*
FORM cleanup_workflows USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.
zls_param-selname = 'I_DISPLY'. " delete immediately
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'I_DELERR'. " delete errors as well
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'I_DELLOG'. " delete log as well
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'I_TOPLVL'. " top level only
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'IT_CD'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSWWWIDE' zlv_variant.
PERFORM start_job USING 'RSWWWIDE' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_sapoffice
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_SOD
*&---------------------------------------------------------------------*
FORM cleanup_sapoffice USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'TESTMODE'. " remove test mode
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'PACKSIZE'. " package size
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 500.
APPEND zls_param TO zlt_params.


zls_param-selname = 'SRDEL'. " send docs
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'DOCDEL'. " not send docs
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.


zls_param-selname = 'CREATED'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSBCS_REORG' zlv_variant.
PERFORM start_job USING 'RSBCS_REORG' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'TESTMODE'. " remove test mode
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'ADRVP'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'ADRV'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'PACKSIZE'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 5000.
APPEND zls_param TO zlt_params.

PERFORM create_variant TABLES zlt_params USING 'RSBCS_ADRVP' zlv_variant.
PERFORM start_job USING 'RSBCS_ADRVP' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'TESTMODE'. " remove test mode
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'FULL_LOG'. " detailled log
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'CR_DAT'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSBCS_SREQ_EXPIRE' zlv_variant.
PERFORM start_job USING 'RSBCS_SREQ_EXPIRE' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'TESTMODE'. " remove test mode
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'CRDAT'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSBCS_SREQ_INITIAL_RELEASE' zlv_variant.
PERFORM start_job USING 'RSBCS_SREQ_INITIAL_RELEASE' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'TESTMODE'. " remove test mode
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'SNDDAT'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSBCS_DELETE_QUEUE' zlv_variant.
PERFORM start_job USING 'RSBCS_DELETE_QUEUE' zlv_variant 'D'.

zls_param-selname = 'P_AGE'. " amount of days to keep
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'TESTMODE'. " remove test mode
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'DELETE'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'NOT_SENT'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'SENDER'.
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'CP'.
zls_param-low = '*'.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSSODFRE' zlv_variant.
PERFORM start_job USING 'RSSODFRE' zlv_variant 'D'.

zls_param-selname = 'USER'.
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'CP'.
zls_param-low = '*'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'INBOX'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'ALL'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'READONLY'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'RESUB'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'PRIVDOC'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'TRASH'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'REPLY'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_AGE'. " amount of days to keep
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'TEST'. " remove test mode
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'OUTDOCS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'PACKSIZE'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 100.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSSO_DELETE_PRIVATE' zlv_variant.
PERFORM start_job USING 'RSSO_DELETE_PRIVATE' zlv_variant 'D'.

zls_param-selname = 'PPSIZE'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 500.
APPEND zls_param TO zlt_params.

zls_param-selname = 'PTEST'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zlv_date = sy-datum - ziv_days.
zls_param-selname = 'P_UNTIL'. " end date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zlv_date = sy-datum - 9999.
zls_param-selname = 'PDDSINCE'. " start date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSGOSRE02' zlv_variant.
PERFORM start_job USING 'RSGOSRE02' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_rfcdata
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_RFD
*&---------------------------------------------------------------------*
FORM cleanup_rfcdata USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'PAKET'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = '10000'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'CPIC'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'REC'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'FAIL'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'SENT'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'EXEC'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'LOAD'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'RETRY'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'NORETRY'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'PCLNT'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = sy-mandt.
APPEND zls_param TO zlt_params.

zls_param-selname = 'DAY'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSARFCER' zlv_variant.
PERFORM start_job USING 'RSARFCER' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'NRDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'BLK_SIZE'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 5000.
APPEND zls_param TO zlt_params.

zls_param-selname = 'DELSTATE'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'SYSFAIL'.
APPEND zls_param TO zlt_params.

PERFORM create_variant TABLES zlt_params USING 'RSTRFCES' zlv_variant.
PERFORM start_job USING 'RSTRFCES' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_changedocuments
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_CDD
*&---------------------------------------------------------------------*
FORM cleanup_changedocuments USING ziv_days.



DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'OBJECT'.
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'CP'.
zls_param-low = '*'.
APPEND zls_param TO zlt_params.

zlv_date = sy-datum - ziv_days.

zls_param-selname = 'TO_DATE'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zls_param-selname = 'TESTRUN'. "testrun
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_ALV'. "display
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_STAT'. "counting
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_SIZE'. "package size
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 1500.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_LINSHW'. "package size
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 1500.
APPEND zls_param TO zlt_params.

zls_param-selname = 'AUD_DATE'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSCDOK99' zlv_variant.
PERFORM start_job USING 'RSCDOK99' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_WBCROSSGT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_CDD
*&---------------------------------------------------------------------*
FORM cleanup_wbcrossgt USING p_p_cdd.
DATA: zlv_variant TYPE raldb_vari.
CLEAR zlv_variant.
PERFORM start_job USING 'RS_DEL_WBCROSSGT' zlv_variant 'X'.
PERFORM start_job USING 'SAPRSEUB' zlv_variant 'X'.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_batchjobs
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_BJD
*&---------------------------------------------------------------------*
FORM cleanup_batchjobs USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'PRELIM'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'SCHED'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'FIN'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'ABORT'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'PORTION'. "commit counter
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 1000.
APPEND zls_param TO zlt_params.

zls_param-selname = 'TESTRUN'. "testrun
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'APREDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'BPREDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'CPREDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'ASCHDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'BSCHDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'CSCHDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'AFINDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'BFINDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'CFINDAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'AABODAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'BABODAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zls_param-selname = 'CABODAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSBTCDEL2' zlv_variant.
PERFORM start_job USING 'RSBTCDEL2' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_savedlists
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_SLD
*&---------------------------------------------------------------------*
FORM cleanup_savedlists USING ziv_days.


DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'P_DATE'. " up to date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zlv_date = sy-datum - ziv_days.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_TEST'. "testrun
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_WSID'. "local
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSAQQLRE_MASS' zlv_variant.
PERFORM start_job USING 'RSAQQLRE_MASS' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'P_DATE'. " up to date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zlv_date = sy-datum - ziv_days.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_TEST'. "testrun
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_WSID'. "global
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }2|.

PERFORM create_variant TABLES zlt_params USING 'RSAQQLRE_MASS' zlv_variant.
PERFORM start_job USING 'RSAQQLRE_MASS' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_bwlogs
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_BWD
*&---------------------------------------------------------------------*
FORM cleanup_bwlogs USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'P_DATE'. " up to date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zlv_date = sy-datum - ziv_days.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_OWN'. "
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_QUERY'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_LOGG'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_AGHPA'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_DELE'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_BIA'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_DTP'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_WHM'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_WSP'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_AP'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_SL'.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSDDSTAT_DATA_DELETE' zlv_variant.
PERFORM start_job USING 'RSDDSTAT_DATA_DELETE' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'DEL_MSG'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.
zls_param-selname = 'DEL_PAR'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.
zls_param-selname = 'DEL_DTP'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSBATCH_DEL_MSG_PARM_DTPTEMP' zlv_variant.
PERFORM start_job USING 'RSBATCH_DEL_MSG_PARM_DTPTEMP' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'P_DAYS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_SIMU3'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_REORG'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_PKG'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 10000.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSPM_HOUSEKEEPING' zlv_variant.
PERFORM start_job USING 'RSPM_HOUSEKEEPING' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'DATE_S'. " from date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.

zls_param-selname = 'DATE_E'. " to date
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zlv_date = sy-datum - ziv_days.
zls_param-low = zlv_date.
APPEND zls_param TO zlt_params.
zls_param-selname = 'CROSS'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RSBKCLEANUPBUFFER' zlv_variant.
PERFORM start_job USING 'RSBKCLEANUPBUFFER' zlv_variant 'D'.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'P_CL0RT'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_CL1RT'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_SIMU'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = ' '.
zls_param-low = ziv_days.
APPEND zls_param TO zlt_params.
zls_param-selname = 'P_RECRT'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 24.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'ODQ_CLEANUP' zlv_variant.
PERFORM start_job USING 'ODQ_CLEANUP' zlv_variant 'D'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form cleanup_changepointers
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> P_CPD
*&---------------------------------------------------------------------*
FORM cleanup_changepointers USING ziv_days.

DATA: zlv_variant TYPE raldb_vari.
DATA: zlv_date TYPE sy-datum.

CLEAR zls_param.
REFRESH zlt_params.

zls_param-selname = 'P2_DATE'. " creation date
zls_param-kind = 'S'.
zls_param-sign = 'I'.
zls_param-option = 'BT'.
zlv_date = sy-datum - 9999.
zls_param-low = zlv_date.
zlv_date = sy-datum - ziv_days.
zls_param-high = zlv_date.
APPEND zls_param TO zlt_params.


zls_param-selname = 'P_TEST'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = ' '.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P1_OLD'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zls_param-selname = 'P_PACK'.
zls_param-kind = 'P'.
zls_param-sign = 'I'.
zls_param-option = 'EQ'.
zls_param-low = 'X'.
APPEND zls_param TO zlt_params.

zlv_variant = |ZCL{ ziv_days }|.

PERFORM create_variant TABLES zlt_params USING 'RBDCPCLR2' zlv_variant.
PERFORM start_job USING 'RBDCPCLR2' zlv_variant 'D'.

ENDFORM.

SE16T central access to search functions

There are quite some SE16 data browser tools and search tools. SE16T collects them all.

Reference to SE16 blogs:

Background OSS notes on SE16T:

SICF services to be disabled

Some SICF services might be activated from the past. For security they might pose a risk. The best action is to pro-actively disable them.

/sap/bc/bsp/sap/bsp_veri
/sap/bc/bsp/sap/certmap
/sap/bc/gui/sap/its/CERTMAP
/sap/bc/bsp/sap/certreq
/sap/bc/gui/sap/its/CERTREQ
/sap/bc/echo
/sap/bc/error
/sap/bc/FormToRfc
/sap/bc/bsp/sap/icf
/sap/bc/srt/IDoc
/sap/bc/idoc_xml
/sap/bc/report
/sap/bc/soap/rfc
/sap/bc/webrfc
/sap/bc/xrfc
/sap/bc/xrfc_test
1422273
*1417568
1417568
*1417568
1417568
626073
626073
626073
1422273
*1487606
1487606
626073
1394100
979467
626073
626073
Remarks on the (*): these services still might have a business need, double check these before de-activating.

Critical services according to note 887164:
/sap/bc/bsp/sap/bsp_model
/sap/bc/bsp/sap/htmlb_samples
/sap/bc/bsp/sap/it00
/sap/bc/bsp/sap/it01
/sap/bc/bsp/sap/it02
/sap/bc/bsp/sap/it03
/sap/bc/bsp/sap/it04
/sap/bc/bsp/sap/it05
/sap/bc/bsp/sap/itmvc2
/sap/bc/bsp/sap/itsm
/sap/bc/bsp/sap/sbspext_htmlb
/sap/bc/bsp/sap/sbspext_phtmlb
/sap/bc/bsp/sap/sbspext_table (see note 2948239)
/sap/bc/bsp/sap/sbspext_xhtmlb
/sap/bc/bsp/sap/system_private
/sap/bc/bsp/sap/system_public

Source: SAP security baseline.

RAL: read access logging

The SAP audit log records transactions, program executions and much more. But it cannot answer questions that are more sensitive. For example, how can you proof that your employee did or did not see a bank account number, or a basic salary pay? Here is where the RAL read access logging function will help. It will record if a user did have display access to a sensitive field (and the value shown to the user). It can be used to proof a user did see. Or when there is no logging (and the logging is setup correctly), help the employee to proof he/she did not see any sensitive data.

This blog will explain the technical setup. Please do check carefully any privacy, legal, HR and other implications of switching on this functionality.

Questions that will be answered in this blog:

  • How to setup up RAL from the basis technology side?
  • How to create a RAL recording?
  • How to activate RAL?
  • How to use RAL monitoring?

RAL technical setup

Activate in SICF transaction the following services:

  • SRALCONFIG
  • SRALMANAGER
  • SRALMONITOR
  • SRALUTIL

If needed set in RZ11 the parameter sec/ral_enabled_for_rfc to 1.

Now start transaction SRALMANAGER:

Choose the option Enabling in Client:

Press change, enable, and Save.

You can run program SRAL_CHECK_PREREQUISITES to see if all activations are done correctly (oss note 2158630 – RAL: Program to check prerequisites).

Create a RAL recording

A recording is needed to indicate which fields need to be added to the read access log. In transaction SRALMANAGER, choose recordings and then create a new one:

We use the example ZTESTBP for business partner.

In the line for the recorder there are 3 buttons:

First one is to display.
Second one to start the recording.

Third one is to add the recording user.

Start the recording:

Now important: keep the web session open.

Go to the SAP GUI and execute your transaction. When you want to add a field to the RAL logging, select the field, press CTRL, right click and select the option “RAL: record field” or use the CTRL+L shortcut.

If you do not add fields the recording is empty!

When completed go back to the RAL admin web screen and press the icon to Stop the recording.

Now you can display the recorded fields:

Create a RAL configuration

We can now use the recording to create a configuration. In the transaction SRALMANAGER choose configurations and create a new one:

In the new complex screen, create a new log group. Then drag and drop from the field list on the bottom left to the target fields:

Then first Check the consistency and when ok, activate the configuration:

Using the RAL logging database

In the administration use the second tab for monitoring, or use transaction RALMONITOR to jump directly to the monitoring database. Important here: select the RAW database first! Then select your criteria:

In the search results you can select the details. In the Field Value at the bottom, you can see the actual value that the user has seen on its screen.

SAP background and references

RAL help file: Read Access Logging | SAP Help Portal.

Background on recording function: Read access logging(Recording functionality) – SAP Community.

Background on dynpro: Read Access Logging – Dynpro Configuration Step-by… – SAP Community.

Background OSS notes:

Bug fixes:

SAP GUI 64 bit

SAP GUI comes with a 32 and 64 bit version. The advantage of the 64bit version is the performance. The setback is its dependency on, and its compatibility with, the 64bit Microsoft Office products.

A user cannot have both versions installed on a single machine. It is either the 32bit or 64 bit version.

Download location: 3398259 – Where to download 64-bit patches for SAP GUI for Windows 800. – SAP for Me.

Keep track of the SAP GUI build in this blog. With the upcoming SAP GUI 8.10 the information below (which is valid for 8.0) might be different.

Differences between 32bit and 64bit

The main differences are describes in OSS note 3218166 – SAP GUI for Windows: Functional differences of the 64bit version compared to the 32bit version.

The better performance of the controls and download functions are described in this OSS note: 2724656 – SAP GUI NWRFC Controls: 64bit support for Logon, Table, Function and BAPI controls – SAP for Me.

Compatibility issues

The Office compatibility issues are described in the following OSS notes:

Basic rule: when SAPGUI 64bit is to work with Office products, make sure also the Office products are installed with 64bit version.

Enable SNC settings for SAP Cloud Connector

Secure Network Communication (SNC) is a key requirement in enterprise landscapes where SAP BTP interacts with ABAP systems via SAP Cloud Connector (SCC). Enabling SNC ensures encrypted RFC communication, mutual authentication, and end‑to‑end protection of sensitive data.

This blog provides a generic, implementation‑ready guide for enabling SNC between SAP Cloud Connector and SAP ABAP systems.
It combines the official SAP documentation with hands‑on technical steps commonly followed in real projects.

Background OSS note: 3536285 – SAP Cloud Connector – How to set up general SNC settings for SAP Cloud Connector.

Why Enable SNC?

SNC provides:

  • ✅ Encryption of RFC traffic
  • ✅ Strong authentication between Cloud Connector and ABAP systems
  • ✅ Integrity protection
  • ✅ Compliance with corporate security policies
  • ✅ Reduced risk of man‑in‑the‑middle attacks

SNC is increasingly mandatory in SAP landscapes, especially when integrating BTP services with ERP systems.

High-Level Steps

Below is the complete workflow followed during SNC enablement.

1. Create SEC Directory and Deploy Required SAP Cryptographic Files

On the SAP Cloud Connector host:

  1. Create a secure SECUDIR directory(/usr/sap/sec/)
  2. Download and extract the SAP Cryptographic Library from the Download Center (search for sapcryptolib).
  3. Make sure the Cloud Connector process is running.
  4. Place the required SAP CommonCryptoLib files inside(/usr/sap/sec/):
    • libsapcrypto.so (Linux)
    • sapgenpse tool

This directory holds the Personal Security Environment (PSE) used by SNC.

2. Configure Environment Variables

Set the following environment variables:
SECUDIR=<path to sec directory>
SNC_LIB=<path to SAP crypto library>
setenv SNC_NAME=<p:CN..>

Restart the Cloud Connector service after updating.

3. Generate SNC PSE in Cloud Connector

Using sapgenpse, generate a PSE & Sign the Certificate through Your Internal Certificate Authority.

This converts the self‑signed PSE into a fully trusted SNC PSE.

Please read the blog on Certificate Automation for Linux based: https://www.saptechnicalguru.com/automating-sap-certificate-management-using-sls/ for the detailed instructions.

4. Validate SNC Configuration in Cloud Connector

In the SCC Admin UI:

Configuration → On-Premise → SSL/SNC

Verify:

  • SNC is enabled
  • SNC name (p:CN=…) is visible
  • PSE is correctly detected

5. Enable SNC in BTP Subaccount (On‑Prem → Cloud Direction)

In SAP BTP Cockpit:

Connectivity → Cloud Connectors → ABAP Systems

For each RFC connection:

  • Enable “Use SNC”
  • Maintain SNC partner name of the ABAP system
  • Upload the ABAP system’s SNC certificate if required

6. Configure SNC in the ABAP System (Transaction SNC0)

In the on‑premise ABAP system:

  • Maintain SNC names
  • Import Cloud Connector certificate into the ABAP Trust Manager
  • Ensure profile parameters such as snc/enable and snc/identity/as are set

Restart the cloud connection if profile parameters are updated.


7. Enable SNC in RFC Destinations (SM59)

For each RFC destination:

  • Activate SNC
  • Maintain the partner SNC name
  • Set Quality of Protection (e.g., 3 – integrity + encryption)

Test the RFC connection to verify SNC handshake.


8. Enable SNC in BTP (Cloud → On‑Prem Direction)

For outbound connections from BTP:

  • Enable SNC
  • Configure the SNC partner name (ABAP system)
  • Set QOP (quality of protection)

Test communication via integration flows or services.


9. Functional Validation by Application Teams

Functional teams should validate:

  • All RFC-based interfaces
  • Connectivity from BTP services (e.g., IBP, CPI)
  • Replications and data transfers

All connections should show SNC encryption enabled.

Data archiving: Idocs

This blog will explain how to archive idocs via object IDOC. Generic technical setup must have been executed already, and is explained in this blog.

Object IDOC

Go to transaction SARA and select object IDOC.

Dependency schedule:

Main tables that are archived:

  • EDIDC (idoc control record)
  • EDIDS (idoc status record)
  • EDID4 (idoc content)

Technical programs and OSS notes

Write program: RSEXARCA

Delete program: RSEXARCD

Read program: RSEXARCR

Reload program: RSEXARCL

Relevant OSS notes:

Application specific customizing

In transaction WE47 the idoc status must be set to archive-able:

Executing the write run and delete run

In transaction SARA, IDOC select the write run:

Select your data, save the variant and start the archiving write run.

Give the archive session a good name that describes idoc type and year. This is needed for data retrieval later on.

After the write run is done, check the logs. IDOC archiving has average speed, and high percentage of archiving (up to 100%). Mostly errors are not archived due to status (transaction WE47).

Deletion run is standard by selecting the archive file and starting the deletion run.

Data retrieval

Data retrieval is via program RSEXARCR is extremely poor. Setup archive infostructure SAP_IDOC_001, and use transaction SARI (with IDOC and SAP_IDOC_001) to search and retrieve the idocs:

Or use WE09 transaction and include the selection for Archive:

Support maintenance overview on me.sap.com

On me.sap.com there is a support maintenance overview page. You can reach this page via this direct URL: Reporting – SAP for Me. A full explanation of all functions can be found on this blog. The below is the quick manual.

Support maintenance overview

When you start the page you get the total overview:

By clicking on a segment, you can zoom in:

By clicking on the system number you can go to the system administration details:

This can be used to update wrong old information, or to delete systems which have been decommissioned, but are still present in the SAP administration.

Navigation options

You can navigate from the System to the products and addons. Do this by selecting the system in the left part:

Another option is to start with the leading product or addon to see on the left side, which systems have this component installed:

MaxDB tips & tricks

MaxDB has 3 main use cases for SAP:

  • Standalone database (not so much in use)
  • As database for SCM livecache
  • As database for content server

Basically the current 7.9 version is the last supported version until 31.12.2027. Prepare for new solutions if you are still using MaxDB.

Generic MaxDB OSS notes

End of support:

Generic database features of MaxDB:

MaxDB for content server

MaxDB for livecache

S4HANA supports livecache as embedded option. Read more in this blog.

MaxDB management transaction DB59

You can use a central system like SAP solution manager, SAP Focused Run or SAP GRC system to setup a central MaxDb management. For each MaxDB server setup a DB02 secondary database connection.

Then you can use transaction DB59 to get the central overview:

From here you can jump to DBA Cockpit, or run the connection test:

SAP readiness check for SCM

If you are running SCM – APO solution, you need to consider what to do with the functions running there. The extended support of the SCM – APO solution will end by 31.12.2030.

To check the current usage and potential solutions, you can run the SAP readiness check for SAP Supply Chain Solution.

Running the check

Install the check program by applying OSS note 3477050 – SAP Readiness Check for SAP Supply Chain Solutions.

Then start program RC_SCM_COLLECT_ANALYSIS_DATA and execute it:

Schedule the analysis in batch job. When the batch jobs are completed, use the Download Analysis Data button to download the results to your laptop.

Upload the results in the SAP readiness site: https://me.sap.com/readinesscheck .

Results for the SCM readiness check

After uploading the analysis will take a few minutes. When completed, you can see the results: