What is the difference between BAPI and BDC in SAP?
BAPI vs BDC in SAP is a choice between a published interface and a recorded screen sequence. A BAPI is an RFC-enabled function module: you pass structured data, SAP checks and posts it, and a RETURN table says what happened; the caller then commits. BDC (batch input) replays a recorded transaction screen by screen, and the transaction commits itself when it saves. PostNow.ai posts Excel rows through either method and writes SAP's answer back to each row.
- Prefer the BAPI when one fits the transaction. It doesn't depend on screen layouts, personal defaults or screens that change in a support pack, and its RETURN table is built for a program to read.
- Record a BDC when no BAPI fits. Pricing conditions in VK11 and fields that exist only on a custom screen are the usual cases. For MIRO and ME21N, SAP supports no batch input, so those go through their BAPIs.
The rule most consultants apply: use the BAPI when one covers every field you must fill, record the transaction when none does, and prove either on a few documents before volume. The sections below give the mechanics behind that rule, a decision per transaction and the messages you'll read when a row fails. For the wider field, with LSMW, the Migration Cockpit and GUI scripting, see SAP data upload methods.
The difference between BAPI and BDC at a glance
PostNow.ai offers both methods in the same Excel add-in: BAPI mode calls a BAPI you pick from your own SAP system, and recording mode replays a transaction you recorded in SHDB. Both run SAP's own checks, because neither writes to the database tables directly; the difference between BAPI and BDC is in how the data reaches that logic and what comes back.
| Aspect | BAPI | BDC (batch input recording) |
|---|---|---|
| In PostNow.ai | BAPI mode: search the function modules in your system or ask Find with AI, then map Excel columns to the BAPI's fields | Recording mode: record the transaction once in SHDB, then map Excel columns to the recorded fields |
| What it is | An RFC-enabled function module that SAP publishes as a method of a business object | A table of screens, fields and OK-codes (BDCDATA) that replays a dialog transaction |
| Input | Import parameters and tables, such as header, item and X-flag structures | Screen field names and values, in screen order |
| Result | RETURN table (BAPIRET2): type, message class, number, text and variables, plus export parameters such as the document number | The messages the transaction sends (BDCMSGCOLL) and sy-subrc |
| Commit | The caller commits with BAPI_TRANSACTION_COMMIT, or rolls back | The transaction commits itself when it saves |
| Screen changes | No effect: no screens are processed | A new mandatory field, an extra popup or a moved field can stop the replay |
| Coverage | Only objects SAP built a BAPI for | Classic dynpro transactions that support batch input |
| Test without posting | Call it and roll back; some BAPIs also have a TESTRUN flag | Only if the transaction has a check or simulate function you can record |

What a BAPI is in SAP
A BAPI in SAP is an RFC-enabled function module that SAP publishes as a method of a business object. Examples are BAPI_PO_CREATE1 for the purchase order and BAPI_ACC_DOCUMENT_POST for an accounting document. PostNow.ai reads the BAPI's parameters from your own system, so the Excel template matches your release, including customer fields you declare as extensions.
Three rules from SAP's BAPI programming guidelines shape how a BAPI behaves in a mass upload:
- Errors come back in
RETURN, not as dialogs. A BAPI must not sendMESSAGEstatements or display popups. Each message carries a type:Ssuccess,Wwarning,Iinformation,Eerror andAabort. An emptyRETURNmeans no error occurred. - The caller owns the commit. A BAPI generally does not execute
COMMIT WORK; the calling program ends the unit of work withBAPI_TRANSACTION_COMMITorBAPI_TRANSACTION_ROLLBACK. The few BAPIs that commit internally say so in their documentation and are listed in SAP Note 131838. - Changes need X-flags. Change BAPIs and many create BAPIs pair each data structure with an X structure (
POITEMandPOITEMX, for example). A field whose X-flag is blank is ignored, which is the most common reason a BAPI "ignores" a value.
PostNow.ai fills the X structures from the shape of the data structure and asks you to review the ambiguous pairs. Calling a BAPI from Excel step by step, including header and item mapping, is covered in call SAP BAPIs from Excel.
What BDC is in SAP: batch input from a recording
BDC in SAP (batch data communication, or batch input) runs a dialog transaction with data from a table instead of a keyboard. PostNow.ai records the transaction through SHDB, turns the recorded fields into Excel columns, and replays the recording once per document under your own SAP login.
The data table has the structure BDCDATA. Each screen starts with a row that names the program and screen number (PROGRAM, DYNPRO, DYNBEGIN = 'X'), followed by one row per field (FNAM, FVAL), including the cursor position and the OK-code in BDC_OKCODE. Because the real transaction runs, every screen's checks run too: the same field validations, substitutions and messages a user would see. During the replay the system field sy-binpt is 'X', and a few transactions take a different path in batch input, which is why a recording must be tested before it goes into volume.
How to record so the replay is reliable, with screens, OK-codes and line-item loops, is the subject of the BDC recording guide.
Call transaction vs session method (SM35)
The same BDCDATA can be processed in two ways. Call transaction runs it immediately from a program; the session method stores it in a batch input session that is processed later in SM35. PostNow.ai uses call transaction, so each document's result arrives while the Excel row is still in front of you.
| Aspect | Call transaction | Session method |
|---|---|---|
| How it runs | CALL TRANSACTION ... USING bdc_tab, one transaction per call | BDC_OPEN_GROUP, BDC_INSERT per transaction, BDC_CLOSE_GROUP; then processed in SM35 or by a background job |
| When it posts | Immediately | When the session is processed |
| Update mode | You choose: A asynchronous, S synchronous, L local | Always synchronous |
| Messages | Returned to the program with MESSAGES INTO (BDCMSGCOLL), plus sy-subrc | Written to the session log, read in SM35 |
| Failed transactions | The calling program decides what to do with them | Stay in the session and can be reprocessed in the foreground |
| Display mode | A all screens, E errors only, N no screens, P no screens with debugging | Chosen when the session is processed |
Teams pick sessions when a job prepares data at night and a person reprocesses the errors in the morning. Call transaction suits uploads where the person who owns the file also fixes the failed rows, which is the Excel case.
Commit and error handling: BAPI_TRANSACTION_COMMIT vs CALL TRANSACTION
PostNow.ai commits a BAPI call only when its RETURN table holds no E or A message, using BAPI_TRANSACTION_COMMIT with WAIT = 'X'; any error message triggers BAPI_TRANSACTION_ROLLBACK, so a failed row leaves nothing behind. A recorded transaction commits itself when it saves, so its result depends on the update mode.
BAPI: the caller decides
Calling a BAPI without a commit is a classic trap: the BAPI returns a document number and a success message, and nothing appears in SAP, because the unit of work was never committed. WAIT = 'X' makes BAPI_TRANSACTION_COMMIT run COMMIT WORK AND WAIT, which waits for the update task to finish; without it, a program that reads the new document straight away may not find it yet. Check the documentation of the BAPI you use: a few commit internally, and a few report errors in a table other than RETURN.
BDC: the update mode decides
With asynchronous update (A), the transaction hands its changes to the update task and returns; the success message, such as "Document 100000123 was posted in company code 1010", means SAP accepted the save. If the update task then fails, the error appears in SM13, not in the messages. Synchronous update (S) waits for the update to finish, at the cost of a slower run. PostNow.ai runs recordings in mode N with synchronous update, so each row's messages and document number return at once in the Run Log.
What each method tells you when a row fails
Both methods return structured messages: BAPIRET2 for a BAPI, BDCMSGCOLL (message class, number and variables) for batch input. The difference is what the message is about. A BAPI's RETURN was designed for a calling program: it can name the parameter, row and field that failed. Batch input returns whatever the screens sent, in screen order, so the decisive message is often one of several, and a message such as "No batch input data for screen" points at the recording rather than the data. PostNow.ai writes the result of every document to its row in the Run Log column, with the document number in a column of your choice.
When to use BAPI vs BDC
When to use BAPI vs BDC comes down to one question per transaction: does a BAPI cover the fields you need to fill? In PostNow.ai, type the transaction code into Find with AI and it suggests the matching BAPI (FB01 and FB50 lead to BAPI_ACC_DOCUMENT_POST, MIRO to BAPI_INCOMINGINVOICE_CREATE); if none fits, record the transaction instead.
| Situation | Use | Why |
|---|---|---|
| Building the upload in PostNow.ai | Find with AI first, then BAPI mode or recording mode | Both modes share the same Validate, Simulate, Run and Run Log, so switching method does not change how operators work |
| A BAPI covers every field you need (journals, purchase orders, sales orders, goods movements) | BAPI | No screens to break, a RETURN table built for programs, and a rollback when a row fails |
| Supplier invoices with PO reference (MIRO) | BAPI: BAPI_INCOMINGINVOICE_CREATE | SAP Note 381593: batch input is not possible for MIRO |
| Purchase orders (ME21N) | BAPI: BAPI_PO_CREATE1 | SAP Note 217437: ME21N does not support batch input; the BAPI also handles many items per order |
| Pricing conditions (VK11) | Recording | SAP Note 1135984 advises against BAPI_PRICES_CONDITIONS for creating conditions |
| A field only exists on a screen (custom screen, field with no BAPI or extension equivalent) | Recording | The recording fills whatever the screen shows |
| Customer and supplier master on S/4HANA | Business Partner APIs or BAPIs, not an XD01/XK01 recording | On S/4HANA, XD01 and XK01 hand over to transaction BP |
| SAP S/4HANA Cloud, public edition | Released APIs (OData, SOAP) | Integration uses the APIs SAP releases for the cloud edition |
Transaction-by-transaction guides: MIRO mass invoice posting, ME21N purchase orders and VK11 pricing conditions.
BAPI vs BDC performance
BAPI vs BDC performance favours the BAPI, because it posts without running screens. PostNow.ai sends one document per call in both modes, so any speed difference you see comes from the work SAP does for each document.
- Screens cost time even when hidden. Batch input in display mode
Nshows nothing, but every screen's process before output (PBO) and process after input (PAI) logic still runs, field by field. - The commit wait is a choice.
BAPI_TRANSACTION_COMMITwithWAIT = 'X'and synchronous batch input both wait for the update task. That costs time per document and buys a confirmed result before the next row starts. - Sessions move the time, not remove it. The session method writes the data to the batch input queue first and posts it later, with synchronous update.
- Multi-object BAPIs. Some BAPIs, such as
BAPI_BILLINGDOC_CREATEMULTIPLE, process many objects in one call.
For a typical Excel load of a few hundred documents, the method rarely decides whether it finishes on time. Fixing and re-posting failed rows takes longer than the posting itself, which is why the error handling above matters more than raw speed. Planning the volume of a large load is covered in SAP mass upload from Excel.
How PostNow.ai runs BAPI and BDC uploads from Excel
PostNow.ai runs both methods from the same ribbon in Excel, on the user's own computer and under the user's own SAP login, so SAP authorisations apply to every posting. A designer builds the template once; operators fill the sheet and run it.
- Pick the method. In BAPI mode, search the function modules in your system or ask Find with AI. In recording mode, click Record: PostNow.ai opens a new SAP GUI session and records the transaction through SHDB.
- Map the columns. Drag BAPI fields or recorded fields onto Excel columns, or let Mapping AI match your file's headers to the BAPI's fields. Mapping AI receives column headers, never row values. Set fixed values, date formats, leading zeros and allowed values per field.
- Group header and items. A marker column (H for header, D for detail) turns one header row and its item rows into one document. Recordings repeat the item screen in a loop band; BAPIs fill their item tables.
- Validate. Validate checks the sheet offline: required fields, type, length, characters, dates, decimals and allowed values. Failing cells are marked before anything reaches SAP.
- Simulate. BAPI Simulate calls the BAPI and then
BAPI_TRANSACTION_ROLLBACKinstead of a commit. Recording Simulate replays the screens without saving and gives each document a verdict: would post, would post with warnings, or would not post. - Debug a recording if needed. Debug replays the recording in SAP GUI in the foreground, showing all screens or only the screens with errors.
- Run. BAPI rows are committed with
BAPI_TRANSACTION_COMMITwhen SAP returns no error; recordings replay without screens (display modeN). Every document's message lands in the Run Log column, and the document number goes to the column you chose. - Re-run safely. Before a real Run, PostNow.ai reads the Run Log and lists documents that already posted, with Skip posted rows, Post again or Cancel. Retry Failed re-posts only the rows marked ERROR. A row marked UNKNOWN lost SAP's answer after it was sent, so look it up in SAP before posting it again.
BAPI mode works with standard RFC and needs nothing installed in SAP beyond the user's RFC authorisation. Recording mode uses a small set of ZPOSTNOW_* function modules, installed once per system and transported like other Z objects. A template published to the team library becomes run-only, which keeps the design and run roles apart; that side is covered in Excel to SAP automation.
Worked example: one month-end pack, two methods
A PostNow.ai designer at company code 1010 builds three templates for month end and picks the method per transaction, not per project.
| Load | Rows | Method | What the run returns |
|---|---|---|---|
| Accrual journals (FB50) | 240 lines in 80 documents | BAPI: BAPI_ACC_DOCUMENT_POST | Document number on each H row; an unbalanced document comes back with an E message and is rolled back |
| Supplier invoices (MIRO) | 35 invoices against purchase orders | BAPI: BAPI_INCOMINGINVOICE_CREATE | Invoice document number and fiscal year per invoice |
| Price changes (VK11) | 60 records, condition type PR00, sales org 1010, materials such as TG-1001 | Recording of VK11 | The save message and result per record in the Run Log |
The run goes in this order. Validate flags two journal lines whose cost centre is longer than the field allows, and the preparer fixes them in Excel. BAPI Simulate on the journals returns one document that does not balance; the preparer corrects the amount. The VK11 recording is debugged once with errors-only display, then run for all 60 records. Three invoices carry a posting date in last month's closed period and fail with "Posting period ... is not open" (F5 201); the other 32 post. AP moves the three posting dates into the open period, and Retry Failed re-posts only those rows. The VK11 run returns a save message for each of the 60 records in the Run Log.
Two templates use a BAPI because SAP offers one that covers the fields. The third is a recording because SAP advises against the pricing BAPI for this job. Operators see no difference: same ribbon, same Run Log.
BAPI vs BDC in S/4HANA
PostNow.ai posts to S/4HANA on-premise through the same two methods, and adds a third: API mode, which posts Excel rows through SAP's published OData V2, OData V4 and SOAP APIs. Which method fits depends on what S/4HANA changed for the object.
- Classic transactions still record. Batch input works on SAP GUI dynpro transactions in S/4HANA as it did in ECC. A recording made on ECC still has to be re-recorded and tested on S/4HANA, because screens and mandatory fields can differ after the conversion.
- Some transactions now hand over to another. Customer and supplier master data is maintained in transaction
BP, and XD01 and XK01 redirect to it, so an XD01 recording from ECC has no target. Load business partners through the BP APIs instead; the customer master upload page covers the S/4HANA route. - Fiori apps have no dynpro to record. Where a process lives in a Fiori app, the route is the app's OData service or a BAPI, not a recording.
- BAPIs mostly carry over, with new field lengths. The material number can be 40 characters in S/4HANA, and many BAPIs keep the old 18-character
MATERIALfield next to a newMATERIAL_LONG. Map the long field (and its X-flag) and re-check lengths and conversions in the template, rather than rebuilding it. - Cloud, public edition, uses released APIs. Integrations with SAP S/4HANA Cloud, public edition, use the APIs SAP has released for it, listed on the SAP Business Accelerator Hub.
For testing uploads before and after a conversion, see SAP S/4HANA testing.
What to plan for with each method
PostNow.ai uses SAP's own posting logic for both methods, so SAP's rules decide every result. These are the points to settle before the first real run.
- Simulate before volume. Validate checks the file offline; SAP's own checks start with Simulate. Run it on a handful of documents per template, and again after any configuration change.
- Read the BAPI's documentation. Check whether it commits internally, whether it has a
TESTRUNflag, and which X-flags a change needs. - Record with the users' settings in mind. Personal defaults, screen variants and field status differ by user and client. Record in a client with production customizing and keep the PostNow.ai Debug run as the first test.
- Read the Run Log after recorded runs. Recordings run with synchronous update, so an update error comes back on the row itself, with its message.
- Install the recording objects per system. The
ZPOSTNOW_*function modules go into development, quality and production through your normal transports. - Re-run from the same workbook. The re-post check reads this sheet's Run Log; a new file with the same rows meets only SAP's own duplicate checks, such as the duplicate invoice check.
- Re-test recordings after support packs. A changed screen is the usual reason a recording that worked last month stops.
Common BAPI and BDC errors and the fix
PostNow.ai writes SAP's message for every failed document into its row, so these are the messages you will read in the Run Log.
| Symptom or message | Method | What it means | Fix |
|---|---|---|---|
| Document number returned, nothing in SAP | BAPI | The calling program never committed | Call BAPI_TRANSACTION_COMMIT after a clean RETURN; PostNow.ai does this on every successful row |
| Change "succeeds" but the value is unchanged | BAPI | The field's X-flag was blank | Set the matching field in the X structure |
| 00 344 No batch input data for screen | BDC | SAP showed a screen the recording has no data for, such as a popup for this row's data | Debug the row with errors-only display, then add the screen to the recording or a condition |
| 00 349 Field does not exist in screen | BDC | The recorded field is hidden on this screen, often by field status or a screen variant | Re-record where the field is visible or remove the field; the value was not posted |
| Success message, document missing | BDC with asynchronous update (custom programs) | The update task failed after the save | Check SM13, fix the cause, and post the row again; synchronous update, as PostNow.ai uses, reports it on the row |
| F5 201 Posting period not open | Both | The posting date falls in a closed period | Change the posting date or ask FI to open the period in OB52 |
The full list of recording errors, with causes, is in the BDC recording guide.

