A decision tree, not a five-step checklist

How to automate SAP, when “SAP” is four different products and three of them break the standard advice.

Most guides for this topic walk you through five steps and assume your install is classic SAP GUI for Windows, your Basis team is happy to enable scripting, and your workflow lives entirely inside SAP. None of those assumptions are safe in 2026. This page is the version-by-version decision tree we walk customers through before recommending any tool, including ours. There are four real approaches, and the right one drops out of five questions about your install.

M
Matthew Diakonov
14 min

Direct answer, verified 2026-05-06

How do I automate SAP?

Four real approaches: BAPI / RFC (server-side function calls, cleanest when the function exists and you have ABAP capacity), SAP GUI Scripting (VBScript over SAP’s COM interface, only on classic SAP GUI for Windows, requires Basis to enable sapgui/user_scripting), selector-based RPA (UiPath, Power Automate Desktop, Automation Anywhere — production-grade, weeks to months per transaction), and accessibility-tree AI agents (record once, replay deterministically through the Windows UI Automation tree, no SAP-side change). Which one is right for you depends on your SAP version, your Basis approvals, and whether the workflow leaves SAP. The five questions below pick.

Source for the GUI Scripting prerequisite: SAP’s profile parameter docs on sapgui/user_scripting. Source for the accessibility-tree primitive: the open-source Terminator SDK at github.com/mediar-ai/terminator.

The five questions that pick the approach

We have walked through this with enough customers that the same five questions come back every time. Answer them in order. By the time you finish Q5, two of the four approaches will be off the table for your install, often three.

1

Q1. Which SAP are you actually on?

Classic ECC 6.0 with SAP GUI for Windows is a different automation surface from S/4HANA Fiori, which is a different surface from SAP Business One, which is a different surface from ByDesign and from RISE-hosted instances. The honest answer to 'how do I automate SAP' branches here first.

Classic SAP GUI exposes Win32 controls into the Windows UI Automation tree. Fiori is a Chromium app and exposes its DOM and Chrome accessibility tree. Business One is a separate Win32 client. ByDesign is web-only and pre-S/4HANA. The same word, “SAP,” covers four completely different runtime surfaces, and any prescription that does not name yours is bluffing.
2

Q2. Will Basis enable sapgui/user_scripting?

SAP GUI Scripting is the VBScript COM surface every legacy how-to article reaches for first. It is also disabled by default and requires the Basis team to flip sapgui/user_scripting=TRUE on the application server, plus a separate per-client policy. In regulated environments that is a security review, not a checkbox.

SAP’s own profile-parameter docs show the parameter is gated server-side, and most enterprise security teams treat enabling it as a privilege-escalation surface (any logged-in user with a desktop session can drive the GUI). If the answer to Q2 is no, three of the four prescriptions below are off the table before you start.
3

Q3. Does the BAPI you need actually exist?

BAPI and RFC are the cleanest answer when SAP exposes the function you need and you have ABAP capacity to wrap it. The catch is that the BAPI catalog is uneven. Some transactions have first-class BAPIs (BAPI_ACC_DOCUMENT_POST for journals, BAPI_SALESORDER_CREATEFROMDAT2 for sales orders), and some have nothing at all.

Useful test before committing to the BAPI path: open SE37 in your instance, search for the function group around your transaction code (FB01, F-02, VA01, MIGO, MM01), and check whether the BAPI exposes every field your business process actually fills. A BAPI that handles 85% of the document and forces a manual fix-up for the remaining 15% usually loses to a UI-driven approach in TCO.
4

Q4. Does the workflow leave SAP at any point?

A surprising number of “SAP” workflows are not SAP workflows. They open a PDF, validate a number against an Excel file, post into SAP, then write the resulting document number back into a Slack channel or a Snowflake row. BAPI and GUI Scripting can only see the SAP-side fragment.

If the trigger is a file landing in OneDrive or an email arriving in a shared inbox, and the result has to land outside SAP after the post succeeds, the boundary itself becomes the integration. A solution that only types into SAP forces you to glue everything else together with a second tool, a queue, and a custodian who keeps the seams from rotting.
5

Q5. How often does SAP repaint the screens you depend on?

Support packs, screen variants, customer-specific transaction-code wrappers (Z transactions), language packs, and Fiori tile reshuffles all change the surface a UI automation reads. The honest question is not whether the surface changes, it is how your selector strategy degrades when it does.

Pixel-based RPA breaks the day a screen variant shifts a row. Hand-tuned selectors break on the next support pack. Multi-strategy accessibility-tree resolvers fall through several locators (recorded automation id, then the window-relative bounds, then the visible text label, then the parent window) before flagging a step for re-recording. The maintenance cost is dominated by which of those three postures you pick.
70%

The CFO of one F&B chain we moved from UiPath to Mediar told the board they are now saving 70% on automation costs. The arithmetic was per-bot licensing replaced by per-minute runtime, plus the maintenance hours they were no longer spending on selectors.

Mediar customer note, 2026

The four approaches, named honestly

Each of these is a real category with mature vendors. Each is the right answer for some installs. The mistake the existing guides make is prescribing one as if it covered all of them.

BAPI / RFC

Call SAP server-side functions directly. No UI involved. Cleanest when the BAPI exists, you have ABAP capacity, and the workflow stays inside SAP. Falls apart on transactions where the BAPI does not cover every field, on hosted instances where you cannot get an RFC user provisioned, and on workflows that cross the SAP boundary.

SAP GUI Scripting

VBScript over the COM interface SAP exposes inside SAP GUI for Windows. Right answer when Basis has enabled sapgui/user_scripting, your transactions live in classic GUI, and a technical user is willing to maintain the .vbs files. Wrong answer when those three conditions do not all hold.

Selector-based RPA

UiPath, Power Automate Desktop, Automation Anywhere, Blue Prism. Drives SAP GUI through a recorded selector tree. Production-grade and battle-tested. Implementation is weeks to months per transaction because each selector is hand-tuned, and re-tuned on every support pack.

Accessibility-tree AI agents

Record once with an AI agent watching the operator. The agent writes a deterministic workflow file. Replay through the Windows UI Automation tree (saplogon.exe) or the Chrome accessibility tree (Fiori) using the same primitive. No SAP-side change, no Basis ticket, days to production. Mediar is one such tool; the runtime SDK at github.com/mediar-ai/terminator is MIT-licensed.

What about screen scraping with a vision model?

OpenAI Operator, Anthropic Computer Use, and similar can drive SAP if it is on screen. They run a model on every step, which is slow, costs per action, and is non-deterministic, all of which are usually unacceptable on a regulated finance flow. They are interesting for exploration; they are not the answer to a 200-posts-a-day production workload yet.

The version matrix

For each SAP product, here is what each of the four approaches actually buys you. Read the row for the SAP product you actually run. If you run more than one (most enterprises do), read both rows and notice how the same approach changes shape across them.

ECC

ECC 6.0 / S/4HANA classic GUI

BAPI / server-side
Mature catalog. FB01, F-02, VA01, MIGO, MM01 all have first-class BAPIs. First choice when the function exists.
SAP GUI Scripting
Works if Basis enables it. The mature category for in-house technical users.
Selector RPA
UiPath, Power Automate Desktop, Automation Anywhere all have specific SAP activity packs. Battle-tested.
Accessibility-tree agents
Saplogon.exe controls render into the Windows UI Automation tree. Mediar workflows resolve fields through name + role selectors against Edit, ComboBox, Tree, Table.Cell nodes.
F4

S/4HANA Fiori

BAPI / server-side
OData services replace BAPI for Fiori-native flows. Use them. Versioning still matters.
SAP GUI Scripting
SAP GUI Scripting does not apply. Fiori has no GUI Scripting interface.
Selector RPA
Web automation packs work, but the same flows that live in classic GUI for one user often live in Fiori for another. Mixed installs are the common case.
Accessibility-tree agents
Read through Chrome’s accessibility tree (the same one DevTools surfaces in the Accessibility panel). Same primitive a screen reader uses.
B1

SAP Business One

BAPI / server-side
B1 has the DI API and Service Layer (REST). Works when you have a license slot for the integration user.
SAP GUI Scripting
B1 is not classic SAP GUI. GUI Scripting does not apply. The DI API is the equivalent for technical users.
Selector RPA
RPA on B1 is uncommon and expensive per seat. Most B1 customers are mid-market and cannot justify a UiPath spend.
Accessibility-tree agents
B1 is a Win32 client. Same accessibility tree, same primitive. Particularly common in F&B chains running B1 across many locations.
BYD

SAP ByDesign

BAPI / server-side
ByDesign exposes web services. Use the SOAP catalog or the OData layer.
SAP GUI Scripting
ByDesign is web-only. GUI Scripting does not apply.
Selector RPA
Browser-based RPA tools work on ByDesign. Desktop RPA does not.
Accessibility-tree agents
Web accessibility tree, same as Fiori. Browser-driven agents work.
RIS

RISE / hosted ECC and S/4

BAPI / server-side
Often blocked. RFC users are subject to the hosting contract; you may not be allowed one at the volume you need.
SAP GUI Scripting
Sometimes blocked at the hosting layer; ask the provider before you commit. Network paths and remote-desktop layers complicate the COM bridge.
Selector RPA
Selector-based RPA works on the remote-desktop pixel surface but has the highest maintenance overhead because the surface is two layers deep.
Accessibility-tree agents
Citrix and AVD pass through the accessibility tree from the hosted Windows session. The same primitive that drives a local saplogon.exe drives the hosted one.

A worked example: the F-02 journal entry

To make the matrix concrete, walk through one shipping workflow we run for an F&B chain. The transaction is F-02: post a G/L journal entry from a PDF that lands in OneDrive. Four header fields (company code, document type, document date, posting date), then the line items. A human takes around 4 minutes per document. The team posts roughly 200 a day.

Walk it through the matrix. The customer is on classic ECC 6.0 SAP GUI for Windows (Q1 = ECC). Their Basis team will not enable sapgui/user_scripting (Q2 = no), so SAP GUI Scripting is out. There is a BAPI, BAPI_ACC_DOCUMENT_POST, but the workflow needs to validate the totals against an Excel sheet on a network share before the post and write the resulting document number into a Slack channel after (Q4 = workflow leaves SAP), so a pure BAPI implementation forces a second integration tool to handle the boundary. Selector RPA is viable but the customer’s UiPath quote was around six weeks of implementation per transaction code, and they have nine other transactions in the queue (Q5 = many transactions, frequent screen variants).

That set of answers picks the accessibility-tree approach for this customer. The recording pass watches the operator post one document. The runtime is a four-field input schema (zod), nine MCP tool calls for the header (one type_into_element per field plus the OK code navigation), then a loop over the line items, then a get_text against the status bar to read the document number. The whole post runs in roughly 40 seconds. At $0.75 per minute that is about $0.50 per document. Two hundred a day is about $100 a day in runtime, replacing 200 documents × 4 minutes = 13.3 person-hours of work.

Note what is conditional in that paragraph. If the customer’s Basis team had said yes to scripting, GUI Scripting would have been competitive on the SAP-side fragment but still required glue for the OneDrive trigger and the Slack write-back. If they had no other transactions in the pipeline, UiPath’s six-week implementation might have been acceptable. The decision tree, not the brand, is what picks the answer.

What to watch out for, regardless of which approach you pick

License math is not the same as TCO. The cheapest list price loses every time on a workflow that needs maintenance. The number that matters is hours of re-tuning per support pack times your support-pack cadence, added to the per-transaction cost.

Z-transactions break selector assumptions. Customer-specific transaction codes (Z-prefix) often have non-standard control IDs that vendor templates don’t cover. Test your tool against your Z-transactions, not the SAP standard ones, before you sign.

Locale and language packs change selectors. A field labelled “Belegart” in a German install resolves differently from one labelled “Document Type” in an English install. Pick a tool that falls back to language-independent identifiers (automation id, role, window-relative position) and not just visible text.

Audit demands change the architecture. A regulated finance team cannot accept a tool that decides what to type with an LLM at runtime, because the run is non-deterministic. Either pick BAPI (deterministic by construction) or pick a UI tool whose runtime has no model in the hot path (Mediar’s architecture is one example; the recording pass uses a model, the runtime does not).

Hosted SAP makes the install path the hard part. On RISE, on partner-hosted ECC, on Citrix-mediated S/4, the technical question is usually solved quickly. The contract question (can you install a desktop agent on the hosted Windows session?) is what blocks projects for months. Get an answer in writing before you commit.

Where to start once you have picked an approach

If you picked BAPI / RFC. Stand up a sandbox SAP user with the right authorizations. Prototype the call from outside SAP using your language of choice (the Python pyrfc package is the path of least resistance for non-ABAP teams). Verify the BAPI handles every field your business process needs. Build the wrapper service. Wire it up to whatever triggers the workflow.

If you picked SAP GUI Scripting. File the Basis ticket to enable sapgui/user_scripting on the application server. Enable scripting on each client that will run the script. Write the script in VBScript or PowerShell against the SAP scripting API. Plan for re-tuning on the next support pack.

If you picked selector RPA. Install the studio (UiPath, Power Automate Desktop, Automation Anywhere). Record the SAP transaction, walk through the selector tree the studio captured, and clean up the brittle selectors. Build out exception handling. Plan for orchestration licensing on top of the developer license.

If you picked accessibility-tree agents. A developer can prototype against the open-source Terminator SDK at github.com/mediar-ai/terminator: install the Node bindings, write a small TypeScript script that calls type_into_element against your SAP fields, and verify the primitive resolves the controls you expect. For a production workflow with the recording pass and the runtime, talk to us about the turn-key program; the booking link is below.

Want a second opinion on which approach fits your install?

A 30-minute call. Bring your SAP version, your Basis posture on scripting, and the transaction code you want to automate first. We’ll walk the matrix together and tell you honestly which of the four approaches we’d pick, even if the answer is not us.

More questions on SAP automation

What does it mean to automate SAP?

Automating SAP means having a machine perform the data entry, validation, and posting work that a human is doing today inside one of SAP's applications (classic SAP GUI for Windows, S/4HANA Fiori, Business One, or ByDesign). The four real ways to do that are server-side function calls (BAPI, RFC, OData), SAP GUI Scripting (VBScript through SAP's COM interface), selector-based RPA (UiPath and similar driving the rendered controls), or accessibility-tree AI agents (recording an operator once and replaying through the OS-level UI Automation tree). The right one depends on your SAP version, your Basis approvals, and whether the workflow stays inside SAP.

Do I need an SAP license to automate SAP?

Yes, the licensed user that the automation runs as still counts as a named user under SAP's licensing model, regardless of which approach you pick. BAPI and RFC require a dialog or system user with the right authorizations. SAP GUI Scripting, selector RPA, and accessibility-tree agents all run as a logged-in user against the same SAP instance. The licensing question is less about the automation tool and more about how many concurrent SAP sessions you intend to run, which feeds the user-type decision (named, communications, system) on your contract.

Is SAP GUI Scripting still the standard answer?

It is still the most-cited answer in older content, but in regulated environments it is increasingly not the default. SAP GUI Scripting requires Basis to enable sapgui/user_scripting=TRUE on the application server and a per-client allow flag, both of which security review treats as a privilege-escalation surface. It also only applies to classic SAP GUI for Windows; Fiori, B1, and ByDesign each have a different answer. For mid-market and regulated customers we more often see selector RPA (UiPath, Power Automate Desktop) or accessibility-tree agents (Mediar) chosen over GUI Scripting because they don't require the Basis change.

How long does it take to automate one SAP transaction?

BAPI is hours to days when the BAPI exists and you have an ABAP developer. SAP GUI Scripting is a couple of days for a one-screen flow once Basis has enabled scripting and the script author has the field mapping. Selector-based RPA on a single transaction is typically two to six weeks per developer, dominated by selector tuning and exception handling. Accessibility-tree agents sit in days because the recording pass writes the workflow file and the runtime is deterministic replay; we have shipped F-02 journal-entry workflows in under a week of total elapsed time. The number you should care about is not first-deploy time, it is what re-tuning a workflow costs after a support pack.

Can I automate SAP without writing ABAP?

Yes. ABAP is only required for the BAPI/RFC path. SAP GUI Scripting is VBScript. Selector-based RPA uses the vendor's visual designer (UiPath Studio, Power Automate Desktop) and a low-code expression language. Accessibility-tree agents like Mediar record the operator's actions and emit a TypeScript workflow file; you can read and edit it without writing ABAP. The trade you make by skipping ABAP is that you are driving SAP through its UI rather than its server-side function modules, which is fine for most transactional data entry and not the right tool for batch migration loads.

Does the answer change for S/4HANA Fiori?

Yes, materially. SAP GUI Scripting does not exist on Fiori; it is a web app. BAPI is replaced by OData services, and the catalog is different. Selector RPA needs a web automation pack rather than a desktop one. Accessibility-tree agents read Chrome's accessibility tree on Fiori, which is the same surface a screen reader uses on any web page. The cleanest part of the answer is that the same tool can cover both classic GUI and Fiori in one workflow if it can target both surfaces with one primitive; the messy part is that almost no enterprise actually runs only one of the two, so any plan that picks a tool that handles only classic GUI will need a second tool for the Fiori work.

What about RISE with SAP and hosted environments?

RISE complicates two things. First, RFC users are subject to the hosting agreement, and you may not be allowed one at the volume you need. Second, the desktop on which SAP GUI runs is often a Citrix or Azure Virtual Desktop session managed by SAP or by a partner, and getting a desktop agent installed requires their cooperation. Selector RPA and accessibility-tree agents both work over remote desktop because the accessibility tree passes through, but the install path is contract negotiation rather than a download. BAPI / OData where allowed is usually the cleanest path on RISE precisely because it does not require local install rights.

How do I avoid the screens I automate breaking on the next support pack?

Three habits matter. First, do not pin selectors to absolute pixel position; SAP shifts controls between rows on patch level changes. Second, prefer multi-strategy resolution: try the recorded automation id, then the window-relative bounds, then the visible text label, then the parent-window fallback, and only flag the step for re-recording when all of them miss. Third, instrument every workflow run with a structured failure trace (parent window title, surfaced text, unresolved step id) so you can fix the broken step in minutes instead of debugging a black-box failure for hours. The accessibility-tree approach is friendlier to all three habits than pixel matching.

Will an AI model be making decisions in the running workflow?

Depends on which architecture you pick. Vision-loop tools (OpenAI Operator, Anthropic Computer Use, Browser Use) call a model on every step at runtime, which makes the workflow non-deterministic and is usually unacceptable on a regulated finance flow. Mediar's architecture runs the model exactly once during recording: the model reads the captured event stream, infers the workflow, and writes a TypeScript file. After that, the runtime is deterministic Rust against the Windows UI Automation tree with no LLM in the hot path. A grep of the executor crate at github.com/mediar-ai/terminator finds zero references to OpenAI, Anthropic, or Gemini SDKs at runtime. Two identical inputs produce two identical action sequences. That is the bet that lets a finance team sign off on the workflow.

What does SAP automation cost?

BAPI is mostly an ABAP developer's time plus the SAP-side licensing change to add a system or communications user. SAP GUI Scripting is mostly script-author time plus the Basis hour to enable it. Enterprise selector RPA is per-bot licensing (UiPath sits in the high four figures per attended bot per year, plus Orchestrator) plus implementation. Accessibility-tree agents like Mediar price by runtime minute ($0.75/min on the standard rate) with a $10K turn-key program fee that converts to credits. The honest cost comparison is not list price; it is total cost of ownership including the maintenance hours you will spend re-tuning selectors after support packs.

Can I try one of these approaches without committing?

BAPI requires SAP-side credentials and an ABAP environment, which is a heavier ask. SAP GUI Scripting requires Basis to enable scripting in a sandbox before you can write a useful script. UiPath has a community edition that lets you build a single SAP automation locally. Mediar runs a turn-key program on a paid pilot, but the open-source Terminator SDK at github.com/mediar-ai/terminator (MIT license) is what the runtime uses to type into SAP fields, and a developer can prototype against their own SAP instance with it before talking to anyone.

Where does Mediar fit in this matrix?

Mediar is the accessibility-tree AI agent option. The recording pass writes a TypeScript workflow file, the runtime is deterministic Rust calling the Windows UI Automation tree, the same primitive that types into saplogon.exe also types into Chrome on Fiori, and no SAP-side change is required. We are usually the right answer when (a) Basis will not enable sapgui/user_scripting, (b) the BAPI does not cover the transaction or the workflow leaves SAP, (c) you cannot afford UiPath's per-bot licensing or the implementation timeline, or (d) you have classic GUI and Fiori in the same workflow and need one tool that crosses both. We are the wrong answer when there is a clean BAPI for your transaction and you have ABAP capacity; in that case write the BAPI call.