Skip to main content

How to Read an SAP Table

In this guide, you'll learn how to extract data from SAP ERP tables. By the end, you'll be able to query any SAP table directly from DuckDB.

What You'll Need
  • ERPL extension installed
  • SAP connection credentials
  • 5 minutes

Step 1: Connect to SAP

-- Install and load ERPL
INSTALL 'erpl' FROM 'http://get.erpl.io';
LOAD 'erpl';

-- Connect to your SAP system
ATTACH 'sap://hostname:port' AS sap_system (
USER 'your_username',
PASSWORD 'your_password'
);

Step 2: Read Your First Table

-- Read customer master data
SELECT * FROM sap_rfc_read_table('KNA1', LIMIT => 100);

Common SAP Tables

TableDescription
KNA1Customer Master Data
VBAKSales Document Header
MARAMaterial Master Data

Next Steps