Quick answer

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.

AspectBAPIBDC (batch input recording)
In PostNow.aiBAPI mode: search the function modules in your system or ask Find with AI, then map Excel columns to the BAPI's fieldsRecording mode: record the transaction once in SHDB, then map Excel columns to the recorded fields
What it isAn RFC-enabled function module that SAP publishes as a method of a business objectA table of screens, fields and OK-codes (BDCDATA) that replays a dialog transaction
InputImport parameters and tables, such as header, item and X-flag structuresScreen field names and values, in screen order
ResultRETURN table (BAPIRET2): type, message class, number, text and variables, plus export parameters such as the document numberThe messages the transaction sends (BDCMSGCOLL) and sy-subrc
CommitThe caller commits with BAPI_TRANSACTION_COMMIT, or rolls backThe transaction commits itself when it saves
Screen changesNo effect: no screens are processedA new mandatory field, an extra popup or a moved field can stop the replay
CoverageOnly objects SAP built a BAPI forClassic dynpro transactions that support batch input
Test without postingCall it and roll back; some BAPIs also have a TESTRUN flagOnly if the transaction has a check or simulate function you can record
How a BAPI and a BDC recording each reach SAP: the BAPI passes structured data to a published function module, the recording replays the transaction screen by screen
A BAPI passes data to a published interface; a recording types the same data into the transaction's screens.

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 send MESSAGE statements or display popups. Each message carries a type: S success, W warning, I information, E error and A abort. An empty RETURN means no error occurred.
  • The caller owns the commit. A BAPI generally does not execute COMMIT WORK; the calling program ends the unit of work with BAPI_TRANSACTION_COMMIT or BAPI_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 (POITEM and POITEMX, 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.

AspectCall transactionSession method
How it runsCALL TRANSACTION ... USING bdc_tab, one transaction per callBDC_OPEN_GROUP, BDC_INSERT per transaction, BDC_CLOSE_GROUP; then processed in SM35 or by a background job
When it postsImmediatelyWhen the session is processed
Update modeYou choose: A asynchronous, S synchronous, L localAlways synchronous
MessagesReturned to the program with MESSAGES INTO (BDCMSGCOLL), plus sy-subrcWritten to the session log, read in SM35
Failed transactionsThe calling program decides what to do with themStay in the session and can be reprocessed in the foreground
Display modeA all screens, E errors only, N no screens, P no screens with debuggingChosen 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.

SituationUseWhy
Building the upload in PostNow.aiFind with AI first, then BAPI mode or recording modeBoth 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)BAPINo 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_CREATESAP Note 381593: batch input is not possible for MIRO
Purchase orders (ME21N)BAPI: BAPI_PO_CREATE1SAP Note 217437: ME21N does not support batch input; the BAPI also handles many items per order
Pricing conditions (VK11)RecordingSAP 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)RecordingThe recording fills whatever the screen shows
Customer and supplier master on S/4HANABusiness Partner APIs or BAPIs, not an XD01/XK01 recordingOn S/4HANA, XD01 and XK01 hand over to transaction BP
SAP S/4HANA Cloud, public editionReleased APIs (OData, SOAP)Integration uses the APIs SAP releases for the cloud edition
ⓘ
Check the fields, not only the BAPI name. A BAPI that exists can still lack one field your process needs. Map the full template in PostNow.ai and run Simulate on a few rows before you decide; a recording of the same transaction is the fallback, not the default.

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 N shows 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_COMMIT with WAIT = '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.

  1. 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.
  2. 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.
  3. 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.
  4. Validate. Validate checks the sheet offline: required fields, type, length, characters, dates, decimals and allowed values. Failing cells are marked before anything reaches SAP.
  5. Simulate. BAPI Simulate calls the BAPI and then BAPI_TRANSACTION_ROLLBACK instead 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.
  6. Debug a recording if needed. Debug replays the recording in SAP GUI in the foreground, showing all screens or only the screens with errors.
  7. Run. BAPI rows are committed with BAPI_TRANSACTION_COMMIT when SAP returns no error; recordings replay without screens (display mode N). Every document's message lands in the Run Log column, and the document number goes to the column you chose.
  8. 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.

LoadRowsMethodWhat the run returns
Accrual journals (FB50)240 lines in 80 documentsBAPI: BAPI_ACC_DOCUMENT_POSTDocument 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 ordersBAPI: BAPI_INCOMINGINVOICE_CREATEInvoice document number and fiscal year per invoice
Price changes (VK11)60 records, condition type PR00, sales org 1010, materials such as TG-1001Recording of VK11The 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 MATERIAL field next to a new MATERIAL_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 TESTRUN flag, 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 messageMethodWhat it meansFix
Document number returned, nothing in SAPBAPIThe calling program never committedCall BAPI_TRANSACTION_COMMIT after a clean RETURN; PostNow.ai does this on every successful row
Change "succeeds" but the value is unchangedBAPIThe field's X-flag was blankSet the matching field in the X structure
00 344 No batch input data for screenBDCSAP showed a screen the recording has no data for, such as a popup for this row's dataDebug the row with errors-only display, then add the screen to the recording or a condition
00 349 Field does not exist in screenBDCThe recorded field is hidden on this screen, often by field status or a screen variantRe-record where the field is visible or remove the field; the value was not posted
Success message, document missingBDC with asynchronous update (custom programs)The update task failed after the saveCheck 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 openBothThe posting date falls in a closed periodChange 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.

Frequently asked questions

How does PostNow.ai handle BAPI and BDC uploads from Excel?
PostNow.ai is an Excel add-in that posts rows to SAP through a BAPI, a recorded transaction (BDC) or SAP's published OData and SOAP APIs. In BAPI mode you pick the BAPI from your own system or ask Find with AI, map columns, and PostNow.ai commits each document with BAPI_TRANSACTION_COMMIT only when SAP returns no error. In recording mode you record the transaction once in SHDB and PostNow.ai replays it per document. Both modes share Validate, Simulate, Run, Retry Failed and a Run Log that shows SAP's message and the document number on each row. A 14-day free trial is available.
What is the difference between BAPI and BDC in SAP?
A BAPI is an RFC-enabled function module that takes structured data, posts it through SAP's business logic and reports the outcome in a RETURN table; the caller then commits or rolls back. BDC (batch input) replays a recorded transaction screen by screen, and the transaction commits itself when it saves. A BAPI does not depend on screens; a recording does, so screen changes affect only BDC.
Which is faster, BAPI or BDC?
A BAPI is usually faster, because it posts without running screen logic, while batch input runs every screen's PBO and PAI even when nothing is displayed. Waiting for the update task, with WAIT = 'X' on the commit or synchronous update in batch input, adds time per document in both methods. For most Excel loads, fixing and re-posting failed rows takes longer than the difference in posting speed.
Does a BAPI need BAPI_TRANSACTION_COMMIT?
Yes, for almost every BAPI that creates or changes data. SAP's BAPI guidelines leave the commit to the caller, so without BAPI_TRANSACTION_COMMIT the changes are discarded when the session ends. A few BAPIs commit internally; they say so in their documentation and are listed in SAP Note 131838. Use WAIT = 'X' when the next step reads the new document, and call BAPI_TRANSACTION_ROLLBACK when RETURN holds an E or A message.
What is the difference between call transaction and session method in BDC?
Call transaction runs the batch input data immediately with CALL TRANSACTION USING, returns the messages to the program, and lets you choose asynchronous, synchronous or local update. The session method stores the data in a batch input session with BDC_OPEN_GROUP, BDC_INSERT and BDC_CLOSE_GROUP, and the session is processed later in SM35 or by a background job, always with synchronous update. Failed transactions stay in the session for reprocessing.
Is BDC still supported in S/4HANA?
Yes. Batch input still works for classic SAP GUI transactions in S/4HANA on-premise. XD01 and XK01 now redirect to the Business Partner transaction BP, and processes that exist only as Fiori apps have no screens to record, so use a BAPI or an API for those. SAP S/4HANA Cloud, public edition, integrates through released APIs.
When is BDC the only option?
BDC is the route when no BAPI or released API covers the fields you must fill, for example a field that exists only on a custom screen, or pricing conditions in VK11, where SAP Note 1135984 advises against BAPI_PRICES_CONDITIONS. Some Enjoy transactions are excluded from batch input by SAP, such as MIRO (Note 381593) and ME21N (Note 217437); post those through their BAPIs.
How do LSMW, BAPI and BDC relate?
LSMW is a migration workbench, not a third posting technique: it maps legacy files and then posts through batch input recordings, standard batch input programs, BAPIs or IDocs. So an LSMW object built on a recording carries the same screen dependency as BDC, and one built on a BAPI behaves like a BAPI. In S/4HANA, SAP recommends the Migration Cockpit for data migration.
A professional working in PostNow.ai on a laptop

BAPI or recording, one add-in

Post your next Excel file to SAP

Pick the BAPI or record the transaction, map your columns once, simulate, and get SAP's message and document number back on every row.

Request a demo
Book a demo

Bring one SAP process. We show it end to end.

Tell us where to reach you and which process matters. The PostNow.ai team replies by email to arrange the demo.

  1. 01You send the formIt goes straight to the PostNow.ai team.
  2. 02We agree a timeWe reply to your work email to set up the call.
  3. 03You see your own processA process from your own SAP work, shown from start to finish.

Request your demo

Name, work email and company are needed.

Please use your company email address.
What would you like to see?

We use your details only to arrange the demo. See our privacy policy.