AutoSys + SAP + Oracle: 3 Enterprise Integration Patterns
- SAP jobs (job_type: s) need XBP user with S_XBP_ADM. Locked user = PENDING forever. No error in AutoSys.
- sqlplus wrapper is MANDATORY. Never call sqlplus directly. Check output for ORA- patterns and exit non-zero.
- Oracle EBS job_type: 'o' tracks submission, not execution. Check concurrent manager logs separately.
- SAP integration uses job_type: s and the SAPXPBP interface. Requires XBP user with S_XBP_ADM and S_BTCH_ADM authorisations.
- Oracle EBS integration uses job_type: o to submit concurrent programs. Requires EBS agent and concurrent manager setup.
- Oracle Database integration uses CMD + sqlplus. The trap: sqlplus exits 0 even on SQL errors. Add 'WHENEVER SQLERROR EXIT SQL.SQLCODE'.
- The 5-step pattern: File Watcher → Database load → Stored proc → SAP job → Email report. AutoSys orchestrates across all systems.
- Production failure: SAP XBP user locked after password expiry. Jobs stay PENDING. No error in AutoSys logs. Always involve Basis team in user management.
ERP Integration — 60-Second Diagnosis
SAP job stuck PENDING
autoping -m sap-agentCheck with SAP Basis: SUIM → User → XBP user statussqlplus job SUCCESS but data unchanged
cat $AUTOUSER/std_out_files/JOBNAME.outgrep -i 'ORA-\|SP2-' $AUTOUSER/std_out_files/JOBNAME.outOracle EBS job succeeded but concurrent program failed
# On EBS app server: ls -la $APPLCSF/$APPLLOG/*.logtail -100 $APPLCSF/$APPLLOG/request_<request_id>.logSAP RFC communication error
telnet sap-app-server 3300Check SM59 → RFC destination in SAP GUIProduction Incident
sqlplus user/pass@DB @/scripts/update_proc.sql. The SQL script had a syntax error — a missing semicolon. sqlplus parsed the script, printed 'SP2-0042: unknown command', then exited with code 0. AutoSys saw code 0 and marked the job SUCCESS.
The database never executed the stored procedure call because the script didn't parse. No rows were updated. The DBA team never saw an error because the job 'succeeded' from AutoSys's perspective.WHENEVER SQLERROR EXIT SQL.SQLCODE
WHENEVER OSERROR EXIT 9
2. Also check for parsing errors: WHENEVER SQLERROR EXIT SQL.SQLCODE catches runtime errors. For syntax errors, sqlplus exits 0 unless you use -r option? Actually, syntax errors still return 0. The real fix: wrap sqlplus in a shell script that checks for 'ORA-' or 'SP2-' in the output and exits non-zero.
3. Example wrapper:
``bash
sqlplus -s user/pass@DB @script.sql > sqlplus.out 2>&1
if grep -qi 'ORA-\|SP2-' sqlplus.out; then
echo "SQL error detected"
exit 1
fi
`
4. Always set std_out_file and std_err_file` in the job definition to capture sqlplus output.Production Debug GuideWhen SAP or Oracle jobs don't behave, check these first
AutoSys orchestrates across SAP, Oracle, file systems, and databases in one workflow. That's the value proposition.
The mechanics are simple: special job types for SAP ('s') and Oracle EBS ('o'), plus regular CMD jobs for sqlplus. But the failure modes are not obvious.
sqlplus exits 0 even when your SQL has a syntax error. SAP XBP users expire and jobs silently wait. Oracle EBS concurrent programs return 'Success' even when the program logic failed. This article covers the integration patterns and the gotchas that don't appear in the docs.
AutoSys and SAP — the SAPXPBP interface
AutoSys integrates with SAP R/3 and S/4HANA through the SAP XBP (External Background Processing) interface, also called SAPXPBP. This allows AutoSys to: - Submit SAP background jobs (ABAP programs, reports) - Monitor SAP job status and intercept completion events - Chain SAP jobs with non-SAP jobs in the same workflow
The SAP agent (a specialised AutoSys agent) handles the communication with the SAP application server. Behind the scenes, it uses RFC calls to the XBP function module.
Critical: The XBP user account must have specific authorisations (S_XBP_ADM, S_BTCH_ADM). If the password expires or the account locks, AutoSys jobs will stay PENDING forever with no error in AutoSys logs. The only signal is 'job not starting'.
/* SAP job type — triggers an ABAP program in SAP */ insert_job: PRD_SAP_FI_EOD_CLOSE job_type: s /* 's' = SAP job type */ sap_server_name: PRDSAP /* SAP system/instance name */ sap_report_name: RFBIBL00 /* ABAP report to run */ sap_report_variant: EOD_VARIANT /* variant (parameter set) */ sap_client: 100 /* SAP client number */ machine: sap-agent-server-01 /* machine with SAP agent installed */ owner: sapbatch date_conditions: 1 days_of_week: mon-fri start_times: "18:00" condition: success(PRD_TRADING_LOAD_DAILY) /* runs after trading load */ alarm_if_fail: 1 description: "SAP FI end-of-day period close" /* SAP job with external command (optional) */ sap_external_command: Y_AUTOSYS_CALLBACK /* RFC callback after completion */
AutoSys and Oracle — database job types
AutoSys can trigger Oracle stored procedures, SQL scripts, and Oracle E-Business Suite (EBS) concurrent programs. The approach depends on whether you're calling Oracle Database directly or Oracle ERP application layer.
For Oracle Database: The most common method is a CMD job calling sqlplus. But sqlplus has a fatal flaw: it returns exit code 0 even on SQL errors. You cannot trust its exit code alone.
For Oracle EBS: Use job_type: 'o' to submit concurrent programs directly. This sends the request to Oracle EBS concurrent manager. AutoSys tracks submission success, but not execution success. The concurrent program can fail after start and AutoSys will still show SUCCESS.
/* Method 1: CMD job calling sqlplus with proper error handling */ insert_job: PRD_ORA_RECONCILE_DAILY job_type: CMD command: "/usr/bin/sqlplus_wrapper.sh batchuser/pass@ORCL /scripts/oracle/reconcile.sql" machine: db-server-01 owner: orabatch condition: success(PRD_TRADING_LOAD_DAILY) alarm_if_fail: 1 std_out_file: /logs/autosys/PRD_ORA_RECONCILE_DAILY.out std_err_file: /logs/autosys/PRD_ORA_RECONCILE_DAILY.err /* sqlplus_wrapper.sh content */ #!/bin/bash sqlplus -s $1 @$2 > sqlplus.out 2>&1 if grep -qi 'ORA-\|SP2-\|PLS-' sqlplus.out; then echo "SQL error detected" cat sqlplus.out exit 1 fi exit 0 /* Method 2: Oracle E-Business Suite concurrent program */ insert_job: PRD_ORA_EBS_PAYROLL job_type: o /* 'o' = Oracle EBS job type */ oebs_server_name: PRDEBS oebs_responsibility: GL_SUPER_USER oebs_program_short_name: XLAFSNAPR oebs_argument1: 2026 oebs_argument2: 03 machine: oebs-agent-server owner: ebsbatch alarm_if_fail: 1 std_out_file: /logs/autosys/PRD_ORA_EBS_PAYROLL.out
Practical integration patterns
The most common enterprise AutoSys flow that involves SAP and Oracle typically looks like this: 1. File Watcher detects upstream data file (trade file from external counterparty) 2. CMD jobs load data into staging database (Oracle external table or SQL*Loader) 3. Oracle stored procedure processes data, validates, transforms 4. SAP job runs the period-close or posting ABAP report (using validated data) 5. CMD job generates confirmation report and emails finance team
All five steps are orchestrated by AutoSys with dependency conditions between each step — if any step fails, everything downstream stops and the team is alerted.
Production pattern: Add a validation job after each ERP call. For SAP, check that the XBP user is active before submitting. For Oracle, verify that the stored procedure actually processed rows (check output table counts). Never assume success.
/* Complete 5-step enterprise workflow */ /* Step 1: File Watcher */ insert_job: FW_WATCH_TRADE_FILE job_type: FW watch_file: /data/inbound/trades_*.csv min_file_size: 1024 machine: landing-server run_window: "06:00 - 20:00" /* Step 2: Load to staging */ insert_job: CMD_LOAD_STAGING job_type: CMD command: /scripts/load_trades_to_staging.sh machine: db-server condition: success(FW_WATCH_TRADE_FILE) /* Step 3: Oracle stored procedure */ insert_job: ORA_VALIDATE_TRADES job_type: CMD command: /scripts/oracle_wrapper.sh @/sql/validate_trades.sql machine: db-server condition: success(CMD_LOAD_STAGING) std_out_file: /logs/validate_trades.out /* Step 4: SAP month-end close */ insert_job: SAP_MONTH_CLOSE job_type: s sap_server_name: PRDSAP sap_report_name: Z_MONTH_CLOSE sap_client: 100 machine: sap-agent condition: success(ORA_VALIDATE_TRADES) /* Step 5: Confirmation email */ insert_job: CMD_SEND_REPORT job_type: CMD command: /scripts/send_confirmation.sh machine: mail-server condition: success(SAP_MONTH_CLOSE) alarm_if_fail: 1 on all jobs
| Integration target | Job type code | What AutoSys can do | Failure detection | Prerequisite |
|---|---|---|---|---|
| SAP R/3 / S/4HANA | s (SAP) | Submit ABAP jobs, monitor completion via RFC | Silent — PENDING if XBP user fails | SAP agent + XBP user with S_XBP_ADM |
| Oracle EBS | o (Oracle) | Submit concurrent programs, monitor request ID | Partial — tracks submission, not execution | Oracle EBS agent installed |
| Oracle Database (sqlplus) | CMD (sqlplus) | Run SQL scripts, call stored procs | Broken — sqlplus returns 0 on errors | sqlplus client + wrapper script |
| Oracle Database (wrapper) | CMD (custom) | Run SQL with error checking | Full — exits non-zero on ORA- | Wrapper script + AutoSys std_out capture |
🎯 Key Takeaways
- SAP jobs (job_type: s) need XBP user with S_XBP_ADM. Locked user = PENDING forever. No error in AutoSys.
- sqlplus wrapper is MANDATORY. Never call sqlplus directly. Check output for ORA- patterns and exit non-zero.
- Oracle EBS job_type: 'o' tracks submission, not execution. Check concurrent manager logs separately.
- Add validation jobs after every ERP call. Verify row counts, business keys, and completion statuses.
- Capture stdout/stderr for all ERP integration jobs. That's where the real errors live.
- Cross-system failures cascade silently. Each integration point needs independent error detection.
⚠ Common Mistakes to Avoid
Interview Questions on This Topic
- QHow does AutoSys integrate with SAP?Mid-levelReveal
- QWhat is the SAP XBP interface?SeniorReveal
- QWhat job type code is used for SAP jobs in JIL?JuniorReveal
- QHow do you call an Oracle stored procedure from AutoSys?Mid-levelReveal
- QWhat is the gotcha with sqlplus and exit codes in AutoSys?SeniorReveal
- QHow do you handle cross-system failure cascades in an AutoSys workflow?SeniorReveal
Frequently Asked Questions
How does AutoSys integrate with SAP?
AutoSys integrates with SAP R/3 and S/4HANA through the SAP XBP (External Background Processing) interface. A specialised SAP agent on the AutoSys side communicates with SAP via RFC/BAPI calls to submit ABAP background jobs and monitor their completion.
Job type: 's' in JIL. Prerequisites: SAP agent installed, XBP user with S_XBP_ADM and S_BTCH_ADM authorisations, RFC destination configured in SAP (transaction SM59).
Failure mode: If XBP user password expires, jobs stay PENDING with no AutoSys error. Coordinate user lifecycle with SAP Basis team.
What job type do you use for SAP jobs in AutoSys JIL?
Use job_type: s (lowercase 's') for SAP jobs. This job type requires the SAP agent to be installed on the specified machine and the SAP XBP interface to be configured in the SAP system.
Attributes specific to SAP jobs include: sap_server_name (SAP system ID), sap_report_name (ABAP program name), sap_report_variant (parameter set), sap_client (client number), and optionally sap_external_command for RFC callbacks.
How do you call an Oracle stored procedure from AutoSys?
The simplest method is a CMD job that invokes sqlplus via a wrapper script. Example wrapper:
``bash #!/bin/bash sqlplus -s user/pass@DB @/scripts/call_proc.sql > sqlplus.out 2>&1 if grep -qi 'ORA-' sqlplus.out; then exit 1 fi exit 0 ``
Critical: sqlplus returns exit code 0 even on SQL errors. Never call sqlplus directly. Always wrap it with error detection that checks output for ORA- patterns.
Why does sqlplus exit 0 even when SQL fails?
By design, sqlplus returns exit code 0 for successful parsing and execution attempts, even if SQL statements inside the script fail. It only returns non-zero for fatal errors like cannot connect to database, cannot open SQL file, or out of memory.
This means an AutoSys job calling sqlplus directly will show SUCCESS even when your stored procedure raises ORA-00942 (table not found).
Fix: Add WHENEVER SQLERROR EXIT SQL.SQLCODE to SQL scripts to catch runtime errors. For syntax errors, wrap sqlplus in a shell script that greps the output for error patterns. The wrapper pattern is mandatory for production jobs.
What permissions does the SAP user need for AutoSys integration?
The SAP user (typically a technical Basis user) needs XBP authorisations including: - S_XBP_ADM (XBP Administration — allows external scheduling) - S_BTCH_ADM (Background Processing Administration — allows job submission) - S_RFC (RFC access to XBP function modules)
The exact profile should be set up by your SAP Basis team following SAP Note guidance for XBP. The user should have password never expire (or secure rotation via credential manager) and should be monitored for lock status.
How do you debug an SAP job that stays PENDING in AutoSys?
Step-by-step debugging for PENDING SAP jobs:
- Check SAP agent connectivity:
autoping -m sap-agent-server. If INACTIVE, agent is down or network blocked. - Check XBP user status in SAP: transaction SUIM → User → Display. Look for locked or expired password.
- Check SAP system availability: from agent machine,
telnet sap-app-server 3300(default RFC port). - Check SAP job scheduling log: In SAP transaction SM37, look for the scheduled background job. If it's not there, XBP submission failed.
- Check AutoSys event_demon.log:
grep SAP_JOB_NAME $AUTOUSER/out/event_demon.$AUTOSERV. Look for RFC error messages.
Most common issue: XBP user password expired. Work with Basis team to reset and unlock. Add monitoring for PENDING duration > 30 minutes to alert before business impact.
Developer and founder of TheCodeForge. I built this site because I was tired of tutorials that explain what to type without explaining why it works. Every article here is written to make concepts actually click.