No slash command · from erpl
Reads SAP tables, DDIC views, and CDS views into DuckDB via erpl_rfc. Covers filter pushdown, type mapping, ATTACH as virtual catalog, and data-dictionary discovery.
Ships in erpl. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
sap_read_table reads a table, DDIC view or CDS view through RFC_READ_TABLE (or a compatible function
module) and streams it into DuckDB with real types. It is a full read every time — there is no change
tracking; for recurring incremental loads see erpl-choose-interface.
WHERE on sap_read_table(...) is pushed to SAP when it can be
(table below); otherwise the whole table crosses the wire and DuckDB filters afterwards. The rows are the
same either way — only volume and time differ.MANDT (DDIC type CLNT) predicates are not pushed —
RFC_READ_TABLE rejects them. The secret's client already restricts the read to one client.COLUMNS => [...] or a projection in SELECT cuts the transfer.
Wide tables (BSEG, ACDOCA) are bounded by erpl_rfc_fetch_size; see erpl-performance.ET_DATA. Standard RFC_READ_TABLE returns them only with SAP Note
2246160 installed. Otherwise erpl fails fast naming the column; select fewer columns or set
READ_TABLE_FUNCTION => '/SAPDS/RFC_READ_TABLE2' (or a Z-reader) with a READ_TABLE_DELIMITER.'0000004711'). Compare as strings, or CAST(... AS BIGINT) deliberately.ATTACH lists nothing by default. SHOW TABLES FROM sap is empty unless TABLES is given; tables are
resolved on demand when referenced by name.partitions => N returns the same rows in any order; add ORDER BY.sap_read_table(table_name [, …])| Parameter | Meaning |
|---|---|
table_name | Table, DDIC view or CDS view (e.g. 'SFLIGHT', '/DMO/R_BOOKING_D') |
COLUMNS | LIST(VARCHAR) of field names to read |
FILTER | Raw ABAP WHERE clause sent to SAP as is ('CARRID = ''LH''') |
MAX_ROWS | Stop after this many rows (0 = all) |
threads | Parallel calls across columns (wide tables). 0 = erpl decides |
partitions | Parallel workers across rows (narrow, long tables). Rows unordered |
fetch_size | Concurrent result rows per round-trip; transport only |
READ_TABLE_FUNCTION / READ_TABLE_DELIMITER | Alternative reader FM and its delimiter |
secret | Named sap_rfc secret |
-- Basic reads; WHERE is pushed to SAP
SELECT * FROM sap_read_table('SFLIGHT') WHERE CARRID = 'LH';
SELECT CARRID, CONNID, FLDATE, PRICE, CURRENCY
FROM sap_read_table('SFLIGHT')
WHERE FLDATE BETWEEN DATE '2024-01-01' AND DATE '2024-12-31';
-- Explicit column list, raw ABAP filter and a row cap
SELECT * FROM sap_read_table('SFLIGHT',
COLUMNS => ['CARRID', 'CONNID', 'FLDATE', 'SEATSOCC'],
FILTER => 'CARRID = ''LH''',
MAX_ROWS => 100);
WHERE pushes to SAP| Predicate | Pushed |
|---|---|
=, <>, <, >, <=, >= | yes |
AND / OR over one column, BETWEEN | yes (all arms or none) |
IN (...) | yes, up to a ~4000-character clause |
IS NULL / IS NOT NULL | no (ABAP has no NULL) |
Anything on MANDT / a CLNT field | no |
TIMESTAMP, BLOB, FLOAT, DOUBLE literals | no |
Functions or expressions on the column (upper(CITYFROM) = …) | no |
Non-pushed predicates are still applied by erpl, so the result is always correct. To prove a discrepancy is
not caused by pushdown, compare with SET erpl_rfc_pushdown_filters = false; — the rows must be identical.
-- Flights with their route, filtered on both sides at SAP
SELECT f.CARRID, f.CONNID, f.FLDATE, p.CITYFROM, p.CITYTO, f.SEATSOCC, f.SEATSMAX
FROM sap_read_table('SFLIGHT') f
JOIN sap_read_table('SPFLI', COLUMNS => ['CARRID', 'CONNID', 'CITYFROM', 'CITYTO']) p
USING (CARRID, CONNID)
WHERE f.CARRID = 'LH';
Join keys are not pushed from one SAP table into the other: filter each side explicitly. For a reused SAP
table, read it once into a local table (CREATE TABLE spfli AS SELECT * FROM sap_read_table('SPFLI');) and
join locally.
ATTACH — SAP as a DuckDB catalogATTACH '' AS sap (TYPE sap_rfc); -- default secret, on-demand tables
SELECT CARRID, CARRNAME FROM sap.SCARR;
ATTACH '' AS sap_named (TYPE sap_rfc, SECRET 'my_sap'); -- named secret
ATTACH '' AS sap_flight (TYPE sap_rfc, TABLES 'SFLIGHT,SPFLI,SCARR,S*BOOK'); -- exact names and globs
SHOW TABLES FROM sap_flight;
DETACH sap;
Attached tables are views over sap_read_table, so pushdown and types are identical. ATTACH accepts only
TYPE, SECRET, TABLES, read_table_function and read_table_delimiter — connection parameters such as
USER/PASSWORD belong in the secret, not in ATTACH. Names with a namespace need quoting:
sap."/DMO/TRAVEL".
SELECT * FROM sap_show_tables(TABLENAME => '*FLIGHT*'); -- name pattern (* or %)
SELECT * FROM sap_show_tables(TEXT => '%booking%'); -- description text
SELECT pos, is_key, field, text, sap_type, length, decimals, check_table
FROM sap_describe_fields('SFLIGHT');
SELECT field, text FROM sap_describe_fields('SFLIGHT', LANGUAGE => 'D'); -- German texts
sap_show_tables returns table_name, text and class (TRANSP, VIEW, POOL, CLUSTER);
CDS entities are not in that list — sap_ape_show finds them. sap_describe_fields works for tables, DDIC
views and CDS views; check_table and ref_table/ref_field give foreign keys and the currency/unit field
of amounts.
| DDIC type | DuckDB | Note |
|---|---|---|
| CHAR, CLNT, LANG, CUKY, UNIT | VARCHAR | right-trimmed |
| NUMC, ACCP | VARCHAR | leading zeros kept |
| INT1 / INT2 / INT4 / INT8 | TINYINT / SMALLINT / BIGINT / BIGINT | |
| DEC, CURR, QUAN | DECIMAL(p, s) | precision capped at 38 |
| FLTP | DOUBLE | |
| DATS / TIMS | DATE / TIME | the initial value (00000000 / 000000) becomes NULL |
| UTCLONG, UTCS, UTCM | TIMESTAMP | |
| STRING, SSTR, LCHR | VARCHAR | needs ET_DATA (gotcha 4) |
| RAW, LRAW, RAWSTRING | BLOB | decoded from RFC_READ_TABLE's hex; e.g. RAW(16) UUIDs |
Amounts (CURR) are stored as in the database — their decimal places are not shifted for currencies like
JPY; join ref_field (e.g. CURRENCY) to interpret them. The full mapping is in API_REFERENCE.md
("SAP ↔ DuckDB Type Mapping"). An unknown RFC type becomes VARCHAR unless
SET erpl_rfc_strict_type_check = true;.
-- Per query
SELECT * FROM sap_read_table('SFLIGHT',
READ_TABLE_FUNCTION => '/SAPDS/RFC_READ_TABLE2', READ_TABLE_DELIMITER => '|');
-- For the session
SET erpl_rfc_read_table_function = '/SAPDS/RFC_READ_TABLE2';
SET erpl_rfc_read_table_delimiter = '|';
Precedence, highest first: per-query parameter → ATTACH option → secret field → session setting → default
RFC_READ_TABLE. Any read-only FM with the RFC_READ_TABLE interface works; it needs S_RFC for its
function group. Inspect one with sap_rfc_describe_function('Z_MY_READ_TABLE').
| Situation | Do |
|---|---|
| Large table, few rows needed | Push a selective WHERE (key fields, dates) |
| Wide table (100+ columns) | Project the needed COLUMNS; if memory is the problem lower erpl_rfc_fetch_size |
| Narrow, very long table | partitions => 4..8, then measure |
| String column fails | Drop the column or use an ET_DATA-capable READ_TABLE_FUNCTION |
| Same SAP table used in many queries | Materialise once with CREATE TABLE … AS |
| Need change tracking | ODP or APE (erpl-odp-replication, erpl-ape-cds) |
-- 1. find and understand the table
SELECT * FROM sap_show_tables(TABLENAME => 'SFLIGHT');
SELECT field, is_key, sap_type, text FROM sap_describe_fields('SFLIGHT');
-- 2. read only what is needed into a local table
CREATE OR REPLACE TABLE sflight_lh AS
SELECT CARRID, CONNID, FLDATE, PRICE, CURRENCY, SEATSMAX, SEATSOCC
FROM sap_read_table('SFLIGHT')
WHERE CARRID = 'LH';
-- 3. the connection is released when the scan ends
SELECT sap_rfc_live_connections();
See also: erpl-choose-interface (table vs CDS vs ODP), erpl-performance (threads, partitions,
fetch size), erpl-rfc-functions (BAPIs instead of raw tables), erpl-pipelines (landing reads in a
persistent database).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub datazoode/erpl --plugin erpl12 skills in this plugin
/erpl-ape-cdsExtracting SAP CDS views and entities with erpl_ape through SAP's ABAP Pipeline Engine: discovery with sap_ape_show, sap_ape_describe and sap_ape_preview; full snapshots with sap_ape_read_full (columns, chunk_size, wireformat; server-side filters are refused); delta reads with deletes via sap_ape_read_delta(cds, subscriber_process) and the /1DH/OPERATION column (U after-image, D delete); recovering an interrupted delta from the local erpl_ape.delta_spill with recover => true; subscriptions (sap_ape_show_subscriptions, PRAGMA sap_ape_drop, the ERPL_ prefix); readiness checks with PRAGMA sap_ape_ping, sap_ape_system_info and sap_ape_check_authorizations (read verdict); erpl_ape_allow_unreleased and erpl_ape_prepare_timeout. Use when extracting a CDS view (I_*, C_*, Z*), building an incremental CDS load that must see deletes, or when an APE read is slow to start, refused or unauthorised.
/erpl-bics-metadataExploring SAP BW models, data flows and lineage with erpl_bics metadata functions: InfoProviders and their fields (sap_bics_meta_providers, sap_bics_meta_provider_fields), DataSources (sap_bics_meta_datasources, sap_bics_meta_datasource_fields), transformations and rules (sap_bics_meta_transformations, sap_bics_meta_transform_fields), CompositeProviders (sap_bics_meta_hcpr_components, sap_bics_meta_hcpr_mapping), queries, their elements, usage and runtime statistics (sap_bics_meta_queries, sap_bics_meta_query_elements, sap_bics_meta_query_usage, sap_bics_meta_query_stats), InfoObjects (sap_bics_meta_infoobjects, sap_bics_describe_infoobject), the cross reference sap_bics_meta_objxref, and lineage / impact analysis (sap_bics_lineage_edges, sap_bics_lineage_graph_json, sap_bics_lineage_trace, sap_bics_query_lineage). Use when documenting or auditing a BW system, answering "where does this key figure come from" or "what breaks if I change this InfoObject/DataSource", finding unused queries, or preparing a BW migration.
/erpl-bics-queriesRunning SAP BW queries and cubes from DuckDB with erpl_bics (BICS, the protocol behind Analysis for Office): finding queries with sap_bics_show_queries / sap_bics_show_cubes / sap_bics_show(obj_type => 'QUERY'), describing them with sap_bics_describe and sap_bics_variables, the stateful session workflow sap_bics_begin (id, variables, hierarchy_variables, variant, rows, columns, filters) → sap_bics_rows / sap_bics_columns / sap_bics_filter / sap_bics_set_char_prop (DISPLAY KEY|TEXT|BOTH, SORT, TOTALS) / sap_bics_attributes / sap_bics_hidden_members → sap_bics_result, structure members, BW hierarchies with sap_bics_hierarchy, result shape and pivoting, the result cell budget (erpl_bics_max_result_memory), sap_bics_result_stats for empty results, and session cleanup with sap_bics_end / sap_bics_sessions / sap_bics_gc. Use when someone wants numbers from a BW query or InfoCube/aDSO, needs to fill BEx variables, drill down, filter or swap axes, or gets an empty, rejected or too-large BW result.
/erpl-choose-interfaceChoosing the right erpl interface for an SAP object or task before writing SQL: transparent table or DDIC view → sap_read_table / ATTACH (erpl_rfc); BAPI or function module → sap_rfc_invoke; CDS view or entity → sap_ape_read_full / sap_ape_read_delta (erpl_ape) or the ODP context ABAP_CDS; extractor (DataSource, 2LIS_*, 0FI_*), SLT or BW InfoProvider replication → sap_odp_read_full / sap_odp_read_delta (erpl_odp); SAP BW query or cube with its business logic → sap_bics_begin / sap_bics_result (erpl_bics); BW modelling metadata and lineage → sap_bics_meta_* / sap_bics_lineage_*. Covers full vs delta (including deletes), discovery functions per interface, and editions. Use when a user names an SAP object (table, CDS view, extractor, query) and asks how to get it into DuckDB, or when deciding between ODP, APE and RFC for a recurring or incremental load.
/erpl-deployRunning erpl in production: pinning DuckDB and erpl versions, installing on servers, containers and CI (INSTALL erpl FROM get.erpl.io or an offline release archive, the -unsigned / allow_unsigned_extensions setting, the extension directory the trampoline writes to), Python/Node/R hosts, choosing the RFC backend (erpl_rfc_backend nwrfc vs proto, ERPL_RFC_BACKEND), handling secrets on servers (persistent secret directory, secrets from the environment, SNC and certificates), the SAP-side package for the Basis team (dedicated RFC user, S_RFC scoped with sap_rfc_authorizations(), the APE role checked with sap_ape_check_authorizations(), WebSocket RFC/UCON), network paths (SAProuter, erpl_tunnel), and telemetry policy (DATAZOO_DISABLE_TELEMETRY). Use when moving an erpl workload from a laptop to a server, container, scheduler or CI job, or when preparing the SAP user and authorizations for go-live.
/erpl-odp-replicationExtracting and replicating SAP data through ODP (Operational Data Provisioning) with erpl_odp: sap_odp_show_contexts, sap_odp_show, sap_odp_describe (supports_delta), sap_odp_preview, sap_odp_read_full (threads, columns, filters as SIGN/OP/LOW/HIGH ranges), sap_odp_read_delta with a stable subscriber_process (auto DELTAINIT, resume, recover => true), ODQ_CHANGEMODE / ODQ_TSN change columns, the cheap probe sap_odp_get_last_modified, subscription and cursor management (sap_odp_show_subscriptions, sap_odp_show_cursors, sap_odp_get_subscriptions, PRAGMA sap_odp_close_delta_cursor, PRAGMA sap_odp_drop), and why the columns argument aggregates BW providers. Use when reading SAP extractors/DataSources (SAPI), BW InfoProviders (BW context), extraction-enabled CDS views (ABAP_CDS) or SLT, when building an incremental (delta) load, or when ODP row counts look wrong.
Other plugins' skills for the same job