Go back to the main page

SAP Housekeeping & Job Scheduler

Automated data health maintenance for S/4HANA IDES — all business processes
Client 100 · Company 1710 · Plant 1710

Overview

The SAP Housekeeping Job Scheduler maintains data health across all four business processes (P2P, PP, MRP, OTC) by scheduling periodic background jobs in SAP and monitoring critical system areas. It runs locally via JCo RFC — no SSH into SAP needed.

Scheduled Jobs
1
MM Period Opening (monthly)
Health Checks
4
MM, FI, ML Periods + Number Ranges
Processes Covered
4
P2P, PP, MRP, OTC
Execution
Local
JCo RFC from Mac

Health Dashboard

Run ./jobsched.sh status to see live values. Snapshot as of initial setup:

MM Period — OK Company 1710: Period 2026/04 (current). Automatic monthly opening scheduled.
FI Posting Periods — OK Open 2000/001 through 2030/012. No maintenance needed until 2030.
Material Ledger Periods — OK (2026) All 12 periods exist for 2026. 105 cost estimate numbers covered.
Material Ledger Periods — 2027 Missing No CKMLPP/CKMLCR rows for 2027. Run extend-ml before January 2027.
Number Ranges — OK All ranges below 1% utilization. Extensive headroom for all processes.

Scheduled Jobs

Z_MM_PERIOD_OPEN_1710

PropertyValue
ABAP ProgramRMMMPERI (MM Period Shift)
VariantZ_AUTO_1710
ScheduleMonthly — 1st of each month at 00:30
PurposeOpens the next MM posting period for company code 1710
SAP TcodeMMPV
SAP TableMARV (BUKRS, LFGJA, LFMON)
Why this matters: Without an open MM period, ALL goods movements fail — stock postings (501), goods issues (261), goods receipts (101), and PGI (601). This blocks every business process.

Variant parameters:

ParameterValueDescription
I_VBUKR1710Company code
I_ACTDATXUse actual date to determine period
I_XCOMPXComplete closing (full period shift)

Job Scheduling Flow

How jobs are created and scheduled via JCo RFC:

Step 1 Create Variant
RS_CREATE_
VARIANT_RFC
Step 2 Open Job
BAPI_XBP_
JOB_OPEN
Step 3 Add Step
BAPI_XBP_JOB_
ADD_ABAP_STEP
Step 4 Release
BAPI_XBP_
JOB_CLOSE
Step 5 Set Periodic
BAPI_XBP_JOB_
HEADER_MODIFY
Key discovery: RS_CREATE_VARIANT cannot be called remotely, but RS_CREATE_VARIANT_RFC can. This is the RFC-enabled version that allows creating report variants (selection screen values) from outside SAP.

BAPIs & Function Modules

Job Scheduling

BAPIPurposeKey Parameters
RS_CREATE_VARIANT_RFCCreate report variantCURR_REPORT, CURR_VARIANT, VARI_CONTENTS
BAPI_XBP_JOB_OPENCreate background jobJOBNAME → returns JOBCOUNT
BAPI_XBP_JOB_ADD_ABAP_STEPAdd program stepABAP_PROGRAM_NAME, ABAP_VARIANT_NAME
BAPI_XBP_JOB_CLOSERelease/schedule jobJOBNAME, JOBCOUNT
BAPI_XBP_JOB_HEADER_MODIFYSet periodic schedulingJOB_HEADER.PERIODIC, PRDMONTHS, SDLSTRTDT
BAPI_XBP_JOB_DELETEDelete a jobJOBNAME, JOBCOUNT
BAPI_XBP_JOB_START_IMMEDIATELYRun job nowJOBNAME, JOBCOUNT

Key SAP Tables

TableContentKey Fields
TBTCOJob catalogJOBNAME, JOBCOUNT, STATUS, PERIODIC, SDLDATE
TBTCPJob stepsJOBNAME, JOBCOUNT, PROGNAME, VARIANT
VARIDVariant catalogREPORT, VARIANT, ENAME, EDAT
VARITVariant descriptionsREPORT, VARIANT, LANGU, VTEXT
MARVMM period controlBUKRS, LFGJA (year), LFMON (period)
T001BFI posting periodsBUKRS, account type, from/to period
CKMLPPML period dataKALNR, BDATJ, POPER
CKMLCRML currency dataKALNR, BDATJ, POPER, CURTP
NRIVNumber rangesOBJECT, NRRANGENR, FROMNUMBER, TONUMBER, NRLEVEL

Job Status Codes (TBTCO.STATUS)

CodeMeaningIcon
SScheduled (waiting for start time)
RActive (currently running)
FFinished successfully
AAborted (failed)
PPlanned (not yet released)

Health Check Areas

MM Period (MARV)

Controls which period goods movements post into. Must be current or ahead of calendar month.

CheckConditionError if Failed
Period is currentLFGJA/LFMON >= current year/monthM7 059 — posting period not open

Automated: Job Z_MM_PERIOD_OPEN_1710 runs RMMMPERI monthly.

FI Posting Periods (T001B)

Controls which fiscal periods accept accounting documents (ACDOCA).

Current ConfigStatus
Open from 2000/001 to 2030/012 (all account types)No maintenance until 2030

Material Ledger Periods (CKMLPP / CKMLCR)

Every material with ML valuation needs period rows. Missing rows cause production confirmation to fail.

TableRows RequiredPer Material Per Month
CKMLPP1 rowKALNR + BDATJ + POPER
CKMLCR2 rowsCURTP 10 (company) + CURTP 30 (group)
No standard ABAP program exists for ML period extension. The extend-ml command generates a Python/hdbcli script that inserts rows directly via HANA SQL. Run annually before the new year begins.

Number Ranges (NRIV)

Number ranges for orders, documents, and planned orders. Currently all below 1% utilization.

ObjectRangeDescriptionMax
AUFTRAG01Production / internal orders1,999,999
MATBELEG01Material documents (01xx)199,999,999
MATBELEG02Material documents (49xx)4,999,999,999
RV_BELEG01Sales documents4,999,999
PLAF04Planned orders4,999,999,999

Cross-Process Impact

Which health areas affect which business processes:

Health Area P2P PP MRP OTC
MM Period GR (101), IR GI (261), GR (101) - PGI (601)
ML Periods - Confirm (C+/073) - -
FI Periods Invoice posting ACDOCA entries - Billing
Number Ranges PO numbers Order numbers Planned orders Sales orders

Connectivity

Everything runs from the local Mac — no SSH into SAP servers. Client 100 for all operations.

SAP RFC (JCo)

BAPIs and RFC function modules via SAP JCo 3.

Hostsapidess4.fivetran-internal-sales.com
SYSNR03 (port 3303)
Client100
UserIDES
Password(see vault)
LanguageEN

Required: ../SAPjco/sapjco3.jar + libsapjco3.dylib

HANA Database (hdbcli)

Direct SQL via SSH tunnel (tunnel only, no server login).

Tunnellocalhost:30015
DatabaseFIV
UserSAPHANADB
Password(see vault)
ssh -f -N -L 30015:127.0.0.1:30015 root@sapidess4

Python: pip3 install hdbcli

Usage

Commands

CommandDescription
setupCreate variants + schedule all periodic jobs
statusHealth dashboard: MM, FI, ML periods + number ranges
listList all Z_* maintenance jobs and variants
run-now <job>Run a specific job immediately
delete-jobsRemove all Z_* maintenance jobs
extend-mlGenerate ML period extension script for next year

Options: --verbose, --dry-run

Quick Start

# Compile
./compile.sh

# First time: create variants + schedule all periodic jobs
./jobsched.sh setup --verbose

# Health check dashboard
./jobsched.sh status

# List all scheduled maintenance jobs
./jobsched.sh list

# Run MM period opening immediately
./jobsched.sh run-now Z_MM_PERIOD_OPEN_1710

# Preview what delete would do
./jobsched.sh delete-jobs --dry-run

# Show ML period extension script for 2027
./jobsched.sh extend-ml

Annual Maintenance Calendar

Monthly
MM Period Opening Runs automatically via Z_MM_PERIOD_OPEN_1710. Verify with ./jobsched.sh status.
Quarterly
Number Range Check Run ./jobsched.sh status to verify all ranges are below 75% utilization.
Nov / Dec
Extend ML Periods for Next Year Run ./jobsched.sh extend-ml and execute the generated Python script via hdbcli. Must complete before January 1st.
After Restart
Verify Scheduled Jobs Run ./jobsched.sh list to confirm periodic jobs are still active after SAP system restarts.

Troubleshooting

ErrorFix
M7 059 — Posting period not open Run ./jobsched.sh run-now Z_MM_PERIOD_OPEN_1710 or setup
C+/073 — ML period missing Run ./jobsched.sh extend-ml and execute the Python script
Variant does not exist Run ./jobsched.sh setup to recreate variants via RS_CREATE_VARIANT_RFC
Job status = A (aborted) Check SM37 job log in SAP GUI; variant parameters may be incorrect
Number range exhausted Extend range via tcode SNRO (very rare — ranges are below 1% used)
RS_CREATE_VARIANT not remote Use RS_CREATE_VARIANT_RFC — the RFC-enabled version
Job not running after SAP restart Run ./jobsched.sh list — if missing, run setup again

HANA Delta Merge

Weekly Automated Delta Merge

HANA column-store tables use a delta store for fast writes. Over time, unmerged delta rows degrade read performance, especially for catalog queries used by the HANA Web IDE and ABAP dictionary lookups.

PropertyValue
Serversapidess4
ScheduleEvery Sunday at 02:00
Script/usr/local/bin/hana_delta_merge.sh
Log/var/log/hana_delta_merge.log
Mechanismcron (root)
Credentialshdbuserstore key DELTAMERGE (fivadm)
TenantFIV (port 30015)
ThresholdTables with > 10,000 rows in delta store

How It Works

  1. Queries SYS.M_CS_TABLES for all tables with RAW_RECORD_COUNT_IN_DELTA > 10000
  2. Runs MERGE DELTA OF "SCHEMA"."TABLE" for each table (quoted names handle / characters)
  3. Logs before/after counts and any errors

Manual Execution

ssh root@sapidess4 "/usr/local/bin/hana_delta_merge.sh"
ssh root@sapidess4 "cat /var/log/hana_delta_merge.log"

Why This Is Needed

HANA auto-merge uses conservative thresholds and can fall behind on IDES systems where bulk loads (data generators, imports) create large delta stores. In April 2026, tables like STERM_HEAD had 1.6M unmerged rows (last merge: June 2025), causing HANA Web IDE catalog queries to take 16-17 seconds. After forced merge, performance returned to normal.