sap.sync-journal-entries
Page a bounded PostingDate window of SAP journal entries via sap.fetch-journal-entries — through an async, engine-scheduled polling loop — and persist each page into commerce_entity (entity_type=journal_entry).
Page a bounded PostingDate window of SAP journal entries via sap.fetch-journal-entries — through an async, engine-scheduled polling loop — and persist each page into commerce_entity (entity_type=journal_entry).
Overview
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | App-sap |
| Version | 1.0 |
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | Authenticated organization UUID injected by the workflow boundary |
connection_uuid | uuid | Yes | — | Organization-scoped SAP CloudConnection UUID |
start_date | string | Yes | — | Inclusive PostingDate window start, YYYY-MM-DD, forwarded to every page of sap.fetch-journal-entries |
end_date | string | Yes | — | Inclusive PostingDate window end, YYYY-MM-DD; must not precede start_date |
workflow_run_id | string | No | — | Engine-stamped parent DAG run id |
skip | integer | No | — | Starting OData $skip offset within the window; non-negative, defaults to 0 |
top | integer | No | — | OData $top page size passed to sap.fetch-journal-entries per page; 1..1000, defaults to 100 |
max_pages | integer | No | — | Safety cap on pages fetched this run; defaults to 20 |
actor | string | No | — | Optional actor stamp forwarded to commerce persist/cursor workflows |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | Authenticated organization UUID injected by the workflow boundary |
connection_uuid | uuid | Yes | — | Organization-scoped SAP CloudConnection UUID |
start_date | string | Yes | — | Inclusive PostingDate window start, YYYY-MM-DD |
end_date | string | Yes | — | Inclusive PostingDate window end, YYYY-MM-DD |
workflow_run_id | string | No | — | Engine-stamped parent DAG run id |
skip | integer | No | — | Starting OData $skip offset requested for this run |
top | integer | No | — | Effective page size used |
max_pages | integer | No | — | Page cap echoed as applied |
actor | string | No | — | Actor stamp echoed |
current_skip | integer | No | — | Current OData $skip offset for the page about to run / just run |
pages_fetched | integer | No | — | Number of list pages successfully fetched |
synced_count | integer | No | — | Total normalized journal entries seen across pages |
persisted_count | integer | No | — | Rows accepted by data.commerce.entity.persist-batch |
created_count | integer | No | — | New commerce_entity rows created |
updated_count | integer | No | — | Existing commerce_entity rows updated |
rejected_count | integer | No | — | Items rejected by persist-batch |
has_next_page | boolean | No | — | Whether another page remains (record_count == top on last fetch, and pages_fetched < max_pages) |
sap_environment | string | No | — | Environment stamped from the connection via the fetch atom |
started_at | string | No | — | ISO-8601 UTC when sync started |
completed_at | string | No | — | ISO-8601 UTC when sync completed |
failure_reason | string | No | — | Safe terminal failure reason |
failure_type | string | No | — | Stable failure classification |
failed_action | string | No | — | Action that failed |
failed_step | json | No | — | Failed DAG step envelope |
failed_layer | integer | No | — | One-based failed DAG layer |
failed_at_state | string | No | — | State where failure occurred |
error | string | No | — | Safe unexpected error |
error_type | string | No | — | Unexpected exception class |
failed_at | string | No | — | ISO-8601 failure timestamp |
provider_request_ref | string | No | — | Safe provider request reference |
retryable | boolean | No | — | Whether the failure is retryable |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
initiated | Yes | No | — | start | — |
fetching | No | No | — | — | — |
finalizing | No | No | — | complete | — |
planning | No | No | — | begin_fetch | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
initiated | start | planning | — |
planning | begin_fetch | fetching | — |
fetching | fetch_page | fetching | — |
fetching | finish_fetching | finalizing | — |
finalizing | complete | completed | — |
* (any state) | fail | failed | — |
Business Errors
| Code | Message Template |
|---|---|
SAP_ORGANIZATION_CONTEXT_INVALID | Authenticated organization context is missing or does not match the workflow input |
SAP_CONNECTION_NOT_FOUND | SAP connection {connection_uuid} was not found in the authenticated organization |
SAP_CONNECTION_WRONG_PROVIDER | Connection {connection_uuid} is not a SAP connection |
SAP_CONNECTION_SERVICE_UNAVAILABLE | The shared cloud connection service is unavailable |
SAP_PROVIDER_CAPABILITY_MISSING | The installed SAP provider does not expose the required API operation |
SAP_AUTHENTICATION_FAILED | SAP rejected the connection credentials or API key |
SAP_PROVIDER_REQUEST_FAILED | The SAP OData request failed |
SAP_RESPONSE_SHAPE_INVALID | The SAP OData API returned an invalid response |
SAP_PAGINATION_INVALID | skip must be a non-negative integer and top must be between 1 and 1000 |
SAP_WINDOW_INVALID | Dates must use YYYY-MM-DD and be ordered |
SAP_SIDE_INVALID | side must be exactly 'receivable' or 'payable' |
SAP_ENVIRONMENT_INVALID | The connection's SAP environment must be exactly 'sandbox' or 'live' |
SAP_SYNC_PAGE_FETCH_FAILED | SAP sync child fetch failed: |
SAP_SYNC_PERSIST_FAILED | SAP sync persist-batch failed: |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "sap.sync-journal-entries",
"initial_data": {
"organization_uuid": "value",
"connection_uuid": "value",
"start_date": "value",
"end_date": "value"
}
}