ERPL Quick Start (On-Premise)
In this 5-minute tutorial, you'll connect to an on-premise SAP system and read your first table. By the end, you'll be querying SAP data directly from DuckDB.
Prerequisites
- DuckDB installed (version 0.10.0+)
- Access to an on-premise SAP system
- SAP connection credentials (username/password)
- Network access to SAP system (port 33xx)
Step 1: Install ERPL
-- Install ERPL extension
INSTALL 'erpl' FROM 'http://get.erpl.io';
-- Load the extension
LOAD 'erpl';
Success Check
If installation worked, you should see no errors. The extension is now loaded and ready to use.
Step 2: Connect to SAP
-- Connect to your SAP system
ATTACH 'sap://your-sap-host:3300' AS sap_system (
USER 'your_username',
PASSWORD 'your_password'
);
Connection Details
Replace the connection details:
your-sap-host- Your SAP server hostname or IP3300- Your SAP system port (usually 33xx)your_username- Your SAP usernameyour_password- Your SAP password
What's Happening?
Step 3: Read Your First Table
-- Read customer master data
SELECT * FROM sap_rfc_read_table('KNA1', LIMIT => 10);
Understanding the Result
The KNA1 table contains customer master data. You should see columns like:
KUNNR- Customer numberNAME1- Customer nameLAND1- CountryREGIO- Region
Step 4: Filter and Transform Data
-- Get German customers only
SELECT
KUNNR AS customer_id,
NAME1 AS customer_name,
LAND1 AS country,
REGIO AS region
FROM sap_rfc_read_table('KNA1')
WHERE LAND1 = 'DE'
LIMIT 100;
Step 5: Explore More Tables
Here are some common SAP tables you can explore:
-- Sales document header
SELECT * FROM sap_rfc_read_table('VBAK', LIMIT => 5);
-- Material master data
SELECT * FROM sap_rfc_read_table('MARA', LIMIT => 5);
-- Sales document items
SELECT * FROM sap_rfc_read_table('VBAP', LIMIT => 5);
Common SAP Tables Reference
| Table | Description | Key Fields |
|---|---|---|
KNA1 | Customer Master Data | KUNNR, NAME1, LAND1 |
VBAK | Sales Document Header | VBELN, ERDAT, KUNNR |
VBAP | Sales Document Items | VBELN, POSNR, MATNR |
MARA | Material Master Data | MATNR, MTART, MEINS |
LFA1 | Vendor Master Data | LIFNR, NAME1, LAND1 |
BKPF | Accounting Document Header | BUKRS, BELNR, GJAHR |
Troubleshooting
Connection Issues
Error: "Connection refused"
-- Check if port is correct
-- Common SAP ports: 3300, 3301, 3302, etc.
ATTACH 'sap://your-host:3301' AS sap_system (...);
Error: "Authentication failed"
-- Verify username/password
-- Check if user has RFC access
ATTACH 'sap://your-host:3300' AS sap_system (
USER 'correct_username',
PASSWORD 'correct_password'
);
Table Access Issues
Error: "Table not found"
-- Check table name (case-sensitive)
-- Verify table exists in your SAP system
SELECT * FROM sap_rfc_read_table('KNA1', LIMIT => 1);
Next Steps
🚀 Ready for More?
- Read SAP Tables Guide - Detailed table reading
- RFC Deep Dive - Advanced RFC features
- Run BW Queries - Execute SAP BW queries
🔧 Advanced Topics
- RFC Metadata - For SAP experts
- Performance Tuning - Optimize queries
- Function Reference - Complete API docs
💡 Examples
- ERPL Examples - More real-world examples
- Integration with Python - Use with Pandas
What You've Learned
✅ Installed ERPL extension
✅ Connected to SAP system
✅ Read SAP tables
✅ Filtered and transformed data
✅ Explored common SAP tables
You're now ready to use ERPL for your SAP data analysis needs!
Need help? Check our troubleshooting guide or browse more examples.