No slash command · from erpl-odata
Replicates SAP data with full and delta loads through ODP OData services using erpl_odata. Handles change streams, merge logic, subscription state, and common gotchas like missing deltas or HTTP 202 extractions.
Ships in erpl-odata. 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.
Extension: erpl_odata v2026.11.25 | DuckDB: v2.0.1 / v1.5.6
ODP exposes SAP extractors, BW providers and CDS extraction views as OData entity sets
named FactsOf<ODP>, AttrOf<ODP> or EntityOf<ODP>. The first odp_odata_read does
an initial load and opens an ODQ subscription. Every later read returns only the
changes since the previous one.
ODQ_CHANGEMODE column
('D' = delete). INSERT INTO target SELECT * FROM odp_odata_read(...) silently turns
deletes into new rows and duplicates updated keys. Always merge (see below).erpl_web schema of the current database, or the first writable
persistent one. In :memory: the read fails with "ODP delta state requires a
persistent DuckDB database". Open a file (duckdb replication.db) or
ATTACH 'state.db' AS state; USE state;.secret name. Renaming the secret, or switching between
secret := 'x' and scope lookup, starts a new subscription with a new initial load,
and leaves the old one orphaned in ODQ.Preference-Applied: odata.track-changes, the subscription stays in
initial-load mode and every read is a full load, with the warning "Change tracking was
NOT established". That is the safe outcome, and it usually means the source is not
delta-capable (gotcha 7).PRAGMA odp_odata_remove_subscription does
not terminate the ODQ subscription, so SAP keeps queueing changes for it. Clean up in
transaction ODQMON as well.@Analytics.dataExtraction.delta.byElement does not make a CDS view delta-capable.
It activates fine, but RODPS_REPL_ODP_GET_DETAIL reports supports_delta = ' ' and the
service has no DeltaLinksOf<EntitySet>. Use
@Analytics.dataExtraction.delta.changeDataCapture.automatic: true.force_full_load := true discards the token at bind time. A PREPARE or EXPLAIN
of such a statement already forgets it, so the next real read is a full load: extra
work, never missed rows.| Function | Purpose |
|---|---|
odp_odata_show(host_url, secret := ...) | ODP-enabled entity sets on the system: service_id, service_description, entity_set_id, entity_set_description, entity_set_url, change_tracking |
odp_odata_read(entity_set_url, secret := ..., force_full_load := ..., import_delta_token := ..., max_page_size := ...) | Initial load, then deltas |
odp_odata_list_subscriptions() | subscription_id, service_url, entity_set_name, secret_name, delta_token, created_at, last_updated, subscription_status, preference_applied |
PRAGMA odp_odata_remove_subscription(id_or_list [, keep_local_data]) | Forget a subscription locally. keep_local_data = true marks it terminated instead of deleting the record |
odp_odata_read parameters:
| Parameter | Meaning |
|---|---|
secret | Secret to authenticate with. Part of the subscription identity (gotcha 3) |
force_full_load | Drop the stored token and do a new initial load |
import_delta_token | Adopt a token obtained elsewhere, for example after moving the state database |
max_page_size | odata.maxpagesize preference; default 15000 |
The URL must end in an EntityOf…, FactsOf… or AttrOf… entity set, otherwise it is
rejected as not an ODP URL.
CREATE SECRET sap (TYPE http_basic, USERNAME 'DEVELOPER', PASSWORD 'secret',
SCOPE 'http://localhost:50000/');
SELECT service_id, entity_set_id, entity_set_url, change_tracking
FROM odp_odata_show('http://localhost:50000');
change_tracking shows whether the service advertises delta support. If it is false,
expect full loads every time.
Run this as one script per scheduled run against the same database file.
-- duckdb /data/sap_replica.db
LOAD erpl_odata;
CREATE SECRET IF NOT EXISTS sap (TYPE http_basic, USERNAME 'EXTRACT_USER', PASSWORD 'secret',
SCOPE 'https://s4.example.com:44300/');
-- 1. Land the change set (initial load on the first run, delta afterwards)
CREATE OR REPLACE TEMP TABLE changes AS
SELECT * FROM odp_odata_read(
'https://s4.example.com:44300/sap/opu/odata/sap/Z_ODP_SALES_SRV/FactsOfZSALESODP',
secret := 'sap');
-- 2. First run only: create the target with the same shape
CREATE TABLE IF NOT EXISTS sales AS SELECT * FROM changes WHERE false;
-- 3. Remove every key the change set touches (covers updates and deletes)
DELETE FROM sales
WHERE (SalesDocument, SalesDocumentItem) IN (SELECT SalesDocument, SalesDocumentItem FROM changes);
-- 4. Re-insert the surviving after-images, latest image per key
INSERT INTO sales
SELECT * FROM changes
WHERE coalesce(ODQ_CHANGEMODE, '') <> 'D'
QUALIFY row_number() OVER (PARTITION BY SalesDocument, SalesDocumentItem
ORDER BY ODQ_ENTITYCNTR DESC) = 1;
-- 5. Check the subscription moved on
SELECT subscription_id, subscription_status, preference_applied, last_updated
FROM odp_odata_list_subscriptions();
Notes on the merge:
ODQ_CHANGEMODE and ODQ_ENTITYCNTR
are part of the OData key, so do not key on them.ODQ_CHANGEMODE is '' or 'C' for new images, 'U' for after-images and 'D' for
deletes. Test for = 'D' rather than listing every other value, because spelling
differs between providers.force_full_load := true with
CREATE OR REPLACE TABLE is correct and simpler, but it moves the whole provider each run.BEGIN; ... COMMIT; so a failure cannot leave the target half-merged.For a versioned or time-travel target, land each change set into DuckLake or an
append-only history table instead, with a load timestamp, and derive current state with a
QUALIFY view. To diff two loads, use the anofox-tabular plugin's anofox-tabular-diff
skill.
SELECT subscription_id, entity_set_name, secret_name, subscription_status, delta_token
FROM odp_odata_list_subscriptions();
-- Forget one locally (then terminate it in ODQMON as well)
PRAGMA odp_odata_remove_subscription('<subscription_id>');
-- Several at once; keep the record but mark it terminated
PRAGMA odp_odata_remove_subscription(['<id1>', '<id2>'], true);
Recovering a token. If the state database was lost but the ODQ subscription still
exists, read the service's DeltaLinksOf<EntitySet> entity set with odata_read to get
the latest delta token, then continue with import_delta_token := '<token>'.
TerminateDeltasFor<Entity> only flips SubscribedFlag and issues no token.
A large initial load can make SAP answer 202 Accepted. The reader then re-polls,
honouring Retry-After (seconds or an HTTP date) and following Location. Polling is
bounded and ends in an error naming the URL and the time waited. If that happens, run
the initial load in an off-peak window or narrow it (an ODP selection on the SAP side),
rather than retrying in a loop.
Check in this order:
SELECT preference_applied FROM odp_odata_list_subscriptions(): false means SAP never
confirmed change tracking.odp_odata_show(...): is change_tracking true for the entity set?RODPS_REPL_ODP_GET_DETAIL for the ODP: e_supports_delta must
be 'X'. For CDS views this needs changeDataCapture.automatic (gotcha 7).Turn on tracing (SET erpl_trace_enabled = true; SET erpl_trace_level = 'DEBUG';) to see
the Prefer and Preference-Applied headers.
A stock system has no ODP OData service. SAP ships no headless way to create one;
scripts/sap/zcl_odp_provision.abap in this repository performs the three steps the SEGW
guided activity does: generate MPC/DPC, register the model and service, and activate it
in the Gateway hub. Run it with erpl-adt:
erpl-adt object create --type CLAS/OC --name ZCL_ODP_PROVISION --package '$TMP' \
--description 'ODP provisioning'
erpl-adt source write ZCL_ODP_PROVISION --type CLAS --file scripts/sap/zcl_odp_provision.abap
erpl-adt activate ZCL_ODP_PROVISION
erpl-adt object run ZCL_ODP_PROVISION
Facts that cost time the first time:
$F for
#CUBE, $P for #DIMENSION, $T for #TEXT. List them with
SELECT viewname, odpname FROM rsodpabapcdsextb( p_langu = @sy-langu ). Without the
parameter, activation fails with "The parameter P_LANGU was not bound".$TMP: the extraction annotations and classic ODP APIs are not
released for ABAP Cloud.scripts/sap/zjr_odp_v.ddls.abap and scripts/sap/zjr_odp_data.tabl.abap are a working
delta-capable fixture whose contents you control.See also: erpl-odata-sap-gateway (non-delta Gateway reads, service activation),
erpl-odata-setup (secrets, TLS), erpl-odata-production (scheduling the loop,
unattended secrets, monitoring and the error playbook).
Reference docs:
docs/ODP.mdREADME.md (SAP ODP)scripts/sap/zcl_odp_provision.abapWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub datazoode/erpl-odata --plugin erpl-odata8 skills in this plugin
/erpl-odata-dynamics-and-delta-sharingReading Microsoft Dynamics 365 Business Central (bc_show_companies, bc_show_entities, bc_describe, bc_read with company and expand, ATTACH TYPE business_central), Dataverse / Dynamics 365 CRM (crm_show_entities, crm_describe, crm_read) and Delta Sharing shares from Databricks, SAP Business Data Cloud and other providers (delta_share_show_shares, delta_share_show_schemas, delta_share_show_tables, delta_share_scan, profile files) into DuckDB with erpl_odata. Use when the user wants ERP data from Business Central, CRM records from Dataverse, or a table shared over the Delta Sharing protocol.
/erpl-odata-microsoft-365Using Microsoft 365 as a data source and sink from DuckDB with erpl_odata's Microsoft Graph functions: Excel workbooks on OneDrive/SharePoint (graph_show_files, graph_excel_worksheets, graph_excel_tables, graph_excel_read, graph_excel_range, graph_excel_add_rows, graph_excel_delete_rows, ATTACH TYPE excel_workbook, COPY TO FORMAT graph_excel_table), SharePoint lists (graph_show_sites, graph_show_drives, graph_show_lists, graph_describe_list, graph_sharepoint_list_read, graph_sharepoint_create_item / update_item / delete_item, ATTACH TYPE sharepoint_lists with INSERT/UPDATE/DELETE, COPY TO FORMAT graph_sharepoint_list), Planner (plans, buckets, tasks, creating tasks from SQL), Outlook mail, calendars and contacts, Teams channels and messages, and Entra ID users, groups, devices and sign-in logs; app-only vs delegated permissions. Use when the user wants to read or write Excel or SharePoint data, push query results into a list or workbook, create Planner tasks from data, or report on M365 directory, mail or Teams activity.
/erpl-odata-odata-and-restQuerying any OData v2/v4 service and any REST/JSON API from DuckDB SQL with erpl_odata: odata_read (top, skip, expand, count, max_page_size, strict_typing), automatic v2/v4 detection, what WHERE / SELECT / LIMIT push down as $filter / $select / $top, odata_describe, odata_attach and ATTACH ... (TYPE odata), plus http_get / http_head / http_post / http_put / http_patch / http_delete with headers, auth, timeouts, JSON bodies and unpacking JSON responses. Use when the user wants to explore or extract an OData service that is not SAP-specific, call a REST endpoint, page through an API, or turn a JSON response into a table.
/erpl-odata-productionRunning erpl_odata extractions unattended and operating them: job scripts for the DuckDB CLI, persistent DuckDB files or DuckLake as the landing zone, idempotent snapshot and delta (ODP) loads, scheduling with cron or systemd without overlapping runs, unattended credentials (client_credentials, secrets from environment variables, persistent secrets), run logs and monitoring, file tracing (erpl_trace_* settings, PRAGMA erpl_trace_status), and an error-to-fix playbook (401/403, TLS, 404 on /sap/opu, 202 polling, RODPS_REPL_ODP_OPEN, custom service URL guard, NULLs from type conversion). Also how to hand extracted data to other DataZoo tools: flapi to serve it as REST/MCP, anofox-tabular for data-quality gates, anofox-forecast for forecasting and anofox-visualization for dashboards. Use when the user wants to schedule or productionise an extraction, debug a failing job, or build an end-to-end pipeline from SAP or Microsoft data to an API, forecast or dashboard.
/erpl-odata-sap-datasphere-sacPulling SAP Datasphere and SAP Analytics Cloud (SAC) data into DuckDB with erpl_odata: the datasphere secret (oauth2 with authorization_code or client_credentials, config, file), discovery with datasphere_show_spaces, datasphere_show_assets, datasphere_describe_space and datasphere_describe_asset, reading relational assets with datasphere_read_relational and analytic models with datasphere_read_analytical (metrics, dimensions, params, top, skip), and SAC planning and analytic models with sac_read_planning_data, sac_read_analytical and sac_read_story_data using an access_token secret. Also covers what is not implemented yet (SAC discovery functions, ATTACH TYPE sac). Use when the user wants data from a Datasphere space or an SAC model, or asks how to log in to Datasphere from DuckDB.
/erpl-odata-sap-gatewayReading SAP S/4HANA and ECC data through SAP Gateway OData services with erpl_odata: discovering services with odata_sap_show (v2 catalog and v4 service groups), URL anatomy of /sap/opu/odata (v2) and /sap/opu/odata4 (v4 RAP services), basic-auth secrets scoped to the SAP host, describing and attaching a service, SAP-specific quirks (draft entity sets, Edm.DateTime, sap-client, mandatory filters), activating services (/IWFND/MAINT_SERVICE, /IWFND/V4_ADMIN, SICF), and the ABAP trial (A4H) sandbox. Use when the user wants data out of an SAP system via OData, cannot find or reach a Gateway service, or gets 403/404 from /sap/opu. For delta extraction use erpl-odata-sap-odp-replication instead.
Other plugins' skills for the same job