Skip to main content

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 IP
  • 3300 - Your SAP system port (usually 33xx)
  • your_username - Your SAP username
  • your_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 number
  • NAME1 - Customer name
  • LAND1 - Country
  • REGIO - 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

TableDescriptionKey Fields
KNA1Customer Master DataKUNNR, NAME1, LAND1
VBAKSales Document HeaderVBELN, ERDAT, KUNNR
VBAPSales Document ItemsVBELN, POSNR, MATNR
MARAMaterial Master DataMATNR, MTART, MEINS
LFA1Vendor Master DataLIFNR, NAME1, LAND1
BKPFAccounting Document HeaderBUKRS, 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?

🔧 Advanced Topics

💡 Examples

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.