ERP and SAP integration
API client, tokens, webhooks, file routes; the SAP add-on, SM59, STRUST, FF_5 and FLB2.
Data reaches the ERP in four ways. For one bank account, only one route should post to the bank GL account; otherwise entries are posted twice.
- A. API pull + ackthe ERP pulls ready entries, ack/reject
- B. Webhook + pullan event arrives, details from the API
- C. FileMT940, camt, BAI2, Excel…
- D. SAP add-onFF_5, FLB2, FB05
API client
- On ERP › Developer (API) (owner or administrator) enter a client name, the allowed companies and scopes, and press Create client.
- The client ID and secret are shown only once; store them in the ERP's secret settings. The secret can be rotated and the client revoked.
- Scopes: transactions:read, journal:read, journal:write, clearings:read/write, invoices:read/write, counterparties:write, payments:read/write, exports:read/write, reports:read, webhooks:manage. Grant only what is needed.
- The contract (OpenAPI) can be downloaded from the same page; sample requests are on the page.
POST /oauth/token (HTTP Basic: client ID / secret)
grant_type=client_credentials
GET /api/v1/journal-entries?status=ready&company_id=<company>
POST /api/v1/journal-entries/<id>/ack Idempotency-Key: <unique>
{"erp_document_number": "1900001234"}
A token is valid for 1 hour. Idempotency-Key is required on every POST: a repeated request with the same key creates no second record. The rate limit is 600 requests per minute per client (default).
Webhooks
- Events: transaction.created, collection.created, journal_entry.ready, export.completed, export.failed, consent.expiring (others come with their modules).
- The URL must be HTTPS; the body carries only IDs, fetch the details from the API. Signature:
BIY-Signature: t=<time>,v1=<HMAC-SHA256(secret, t + "." + body)>. A non-2xx response is retried for 24 hours.
SAP add-on
- abapGitpull into a Z package, activate
- SM59 ZBIY_TOKEN/oauth/token, Basic, SSL
- SM59 ZBIY_API/api/v1, SSL
- STRUSTBIY certificate chain
- SM36schedule with a variant
- Requirements: SAP_BASIS 7.02 or later and the
/UI2/CL_JSONclass. - ZBIY_FILE_PULL: fetches an MT940, camt.053, BAI2 or lockbox file from BIY, verifies its SHA-256 digest, writes it to the server and runs FF_5 or FLB2 with a variant.
- ZBIY_CLEARING_POST: pulls clearings from the API, posts them with FB05 (or FB01) and reports the result per invoice as ack/reject; the ZBIY_POSTLOG table prevents double posting. Clearings come from matches confirmed in the portal (see Invoices and matching); the program must be installed and tested in the customer system.
- For FF_5 with interpretation algorithm 020/021 the invoice number is placed as "REF …" at the start of the transaction text. For FLB2 lockbox the template must be validated against an RFEBLBT2 sample.
- Authorizations: F_BKPF_BUK (ACTVT 01) and S_DATASET for writing files.
There is no SAP system in this environment; the ABAP code was checked statically (abaplint) and ABAP Unit tests were delivered. The SAP test scenarios (SAP-01…SAP-15) are in sap/README.md in the repository.