ERPL-Web Quick Start (Cloud/Web)
In this 5-minute tutorial, you'll connect to cloud/web SAP services and query your first OData endpoint. By the end, you'll be accessing SAP data via HTTP APIs from DuckDB.
- DuckDB installed (version 0.10.0+)
- Access to SAP cloud services or OData endpoints
- API credentials (API key, OAuth token, or basic auth)
- Internet connection to SAP services
Step 1: Install ERPL-Web
-- Install ERPL-Web extension
INSTALL 'erpl_web' FROM 'http://get.erpl.io';
-- Load the extension
LOAD 'erpl_web';
If installation worked, you should see no errors. The extension is now loaded and ready to use.
Step 2: Connect to OData Service
-- Connect to SAP OData service
ATTACH 'odata://api.sap.com' AS sap_api (
API_KEY 'your_api_key'
);
Replace the connection details:
api.sap.com- Your SAP OData service URLyour_api_key- Your API key or authentication token
What's Happening?
Step 3: Query Your First OData Service
-- Query orders from OData service
SELECT * FROM odata_query(
'Orders',
filter => 'year eq 2024',
limit => 10
);
Understanding the Result
You should see order data with columns like:
OrderID- Order identifierCustomerID- Customer referenceOrderDate- When the order was placedTotalAmount- Order value
Step 4: Filter and Transform Data
-- Get orders from specific customer
SELECT
OrderID,
CustomerID,
OrderDate,
TotalAmount,
Status
FROM odata_query(
'Orders',
filter => 'CustomerID eq "CUST001" and year(OrderDate) eq 2024',
orderby => 'OrderDate desc',
limit => 50
);
Step 5: Connect to SAP Datasphere
-- Connect to SAP Datasphere
ATTACH 'datasphere://your-datasphere-instance' AS datasphere (
API_KEY 'your_datasphere_key'
);
-- Query Datasphere view
SELECT * FROM datasphere_query(
'SALES_ANALYTICS',
year => 2024,
limit => 100
);
Common OData Endpoints
Here are some common SAP OData services you can explore:
-- Sales orders
SELECT * FROM odata_query('SalesOrders', limit => 5);
-- Customers
SELECT * FROM odata_query('Customers', limit => 5);
-- Products
SELECT * FROM odata_query('Products', limit => 5);
-- Employees
SELECT * FROM odata_query('Employees', limit => 5);
OData Query Examples
Filtering
-- Filter by date range
SELECT * FROM odata_query(
'Orders',
filter => 'OrderDate ge 2024-01-01 and OrderDate le 2024-12-31'
);
-- Filter by multiple conditions
SELECT * FROM odata_query(
'Products',
filter => 'Category eq "Electronics" and Price gt 100'
);
Sorting and Pagination
-- Sort by date descending
SELECT * FROM odata_query(
'Orders',
orderby => 'OrderDate desc',
limit => 20
);
-- Skip first 100 records
SELECT * FROM odata_query(
'Customers',
skip => 100,
limit => 50
);
Selecting Specific Fields
-- Select only specific columns
SELECT OrderID, CustomerID, TotalAmount
FROM odata_query('Orders', limit => 10);
Troubleshooting
Connection Issues
Error: "Authentication failed"
-- Check API key format
-- Verify key has correct permissions
ATTACH 'odata://api.sap.com' AS sap_api (
API_KEY 'correct_api_key'
);
Error: "Service not found"
-- Verify service URL
-- Check if service is available
ATTACH 'odata://correct-api-url.com' AS sap_api (...);
Query Issues
Error: "Invalid filter syntax"
-- Use correct OData filter syntax
-- Check field names and operators
SELECT * FROM odata_query(
'Orders',
filter => 'year(OrderDate) eq 2024' -- Correct syntax
);
Error: "Field not found"
-- Check available fields first
-- Use correct field names
SELECT * FROM odata_query('Orders', limit => 1); -- See available fields
Next Steps
🚀 Ready for More?
- Query OData Services Guide - Detailed OData usage
- OData Deep Dive - Advanced OData features
- Connect to Datasphere - SAP Datasphere integration
🔧 Advanced Topics
- OData Metadata - For SAP experts
- Performance Tuning - Optimize queries
- Function Reference - Complete API docs
💡 Examples
- ERPL-Web Examples - More real-world examples
- Integration with Python - Use with Pandas
What You've Learned
✅ Installed ERPL-Web extension
✅ Connected to OData service
✅ Queried SAP web APIs
✅ Filtered and transformed data
✅ Connected to SAP Datasphere
You're now ready to use ERPL-Web for your cloud SAP integration needs!
Need help? Check our troubleshooting guide or browse more examples.