API actions and destinations — SAP Guided Tutorial
Free sample lesson · open to everyone
Calling backend APIs from SAP Build Process Automation: creating action projects from API specifications, configuring BTP destinations for process automation, mapping inputs and outputs, and handling errors.
In this lessonShow sectionsHide sections
Visual overview
The situation: a real project scenario
A process created supplier invoices via API. When a mandatory tax code was missing, instances failed silently. Adding a correction task for 4xx errors and an alert for 5xx errors reduced stuck instances from dozens per week to near zero.
Explanation
Actions are created in an action project from an API specification — imported from somewhere like SAP Business Accelerator Hub or from an OpenAPI file — and only the operations and fields actually needed are selected and released into the action project, rather than exposing the whole API surface.
A BTP destination supplies the target URL and authentication for the backend; it has to be made available specifically to process automation, not just created generically in the subaccount. Process steps map process data to the action's inputs, and store the action's outputs (such as a created document number) in process context for later steps to use.
Calling APIs without planning for errors leaves process instances stuck in an erroneous state that nobody notices until someone asks why a request never went through.
Creating actions: import an API — for example, the purchase requisition API — into an action project; select the operations you need (POST to create, GET to read) and only the fields relevant to your process; test the action against a destination, then release and publish it to the library so other processes can reuse it.
Destinations: created in the BTP subaccount, ideally by IT rather than individual builders, with proper authentication such as OAuth for production systems or basic auth for test systems only; additional destination properties are required to make a destination usable specifically by SAP Build Process Automation, not just by a generic HTTP call; destination variables let the same process definition point at different backends per environment (dev/test/production) without being redeployed.
Mapping: map process inputs and the outputs of earlier steps to the action's inputs; store response values — like the document number the backend just created — in process context so later steps (notifications, follow-up actions) can reference them.
Error handling: plan explicitly for what happens on a 4xx response (a data issue — missing or invalid field) versus a 5xx response (a system issue — backend unavailable); route data issues to a correction task so a person can fix the input and resubmit; retry technical issues only where it's actually safe to do so (i.e. the original call never reached the backend); monitor erroneous instances so failures surface instead of sitting silently.
Step by step: create an action project from a sample API and select one POST operation; configure a destination for the test backend; add the action to a process and map its inputs; deliberately force an error (e.g. omit a mandatory field) and handle it with a correction task. Checkpoint: your process should create a record in the backend, store its document number, and route failures to a visible correction step rather than failing silently.
Watch out
Common mistakes
Exposing every operation and field from an imported API specification, instead of selecting only what the process actually needs, bloats the action project and increases the surface area that has to be maintained and secured when the backend API changes.
Letting builders create destinations with their own personal credentials means the integration breaks the moment that person's password rotates or their account is deactivated, and effectively shares their access with every process that uses it.
Adding no handling at all for API errors means a 4xx (bad data) or 5xx (backend down) response just leaves the instance erroneous with nobody alerted, until the business notices the request never completed.
Blindly retrying a non-idempotent create operation — one that actually creates a new record each time it's called — risks creating duplicate documents if the original call had already reached the backend before the step reported a failure.
Do this
Best practices
Build minimal action interfaces that expose only the operations and fields the process actually needs, rather than the full API surface, so the integration stays easy to secure and maintain as the backend evolves. Have destinations created and managed by IT with proper authentication (OAuth where possible), never with an individual builder's personal credentials, so the integration survives staff changes.
Design explicit error paths for both data errors (4xx, routed to a correction task) and technical errors (5xx, routed to an alert), and monitor erroneous instances actively rather than discovering stuck processes when the business complains.
In the interview
Interview angle
An interviewer may ask: "How would you connect a Build process to S/4HANA to create a document, and what happens when that call fails?" A weak answer stops at "call the API." A strong answer walks the full chain: import the API spec into an action project, select only the needed operations/fields, configure a BTP destination with proper (non-personal) authentication, map process data to action inputs and store the response (e.g. document number) in context — then explicitly distinguishes 4xx data errors (routed to a correction task) from 5xx technical errors (alert IT), and flags that retries on create operations need a check for an already-created document to avoid duplicates.
Practice this lesson
Original educational case studies for SAP consultants, not official SAP certification exam questions. Verify product edition and implementation details against the current SAP documentation.
Quick check
0 of 4 questions attempted
Question 1 of 4
Where are API actions for SAP Build Process Automation defined?
Question 2 of 4
Who should usually create destinations to production backends?
Question 3 of 4
An API call returns 400 because of missing data. What is a good process design?
Question 4 of 4
Why avoid automatic retries for create operations?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1How do you integrate SAP Build Process Automation with an S/4HANA API?
2How do you avoid duplicate documents when processes call APIs?
Was this lesson helpful?
Keep exploring
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.