ERPClimb logoERPClimb

SAP ABAP BAPI Interview Questions

In SAP ABAP rounds, bapi questions are where configuration knowledge meets day-to-day behaviour — what a setting does, and what breaks in a live system when it is wrong.

Master SAP BAPIs with RETURN handling, commit, rollback, extension structures and integration debugging.

This page carries 13 reviewed SAP ABAP bapi interview questions, each with a complete written answer and no sign-in required. The set breaks down into 2 foundational, 7 mid-level and 4 advanced questions, so you can start at the top for a first interview or skip ahead to the scenario-based items for a senior round.

Rehearse these out loud rather than reading them. If you can explain each answer in your own words, including one realistic way it goes wrong on a project, you are covering what a normal SAP ABAP round on bapi expects.

13 BAPI questions with answers

easyBAPI

1. A legacy upload updated sales order tables (VBAK/VBAP) directly and produced inconsistent documents. What is wrong with this approach and what would you use instead?

Direct INSERT/UPDATE on SAP document tables bypasses all business logic: no checks, no pricing, no partner and availability determination, no document flow, no status tables (VBUK/VBUP or status fields), no change documents, no locks and no follow-on updates. The result is data SAP transactions do not understand — inconsistent documents, wrong reporting and support effort. The right approach is a released BAPI — here BAPI_SALESORDER_CREATEFROMDAT2 or BAPI_SALESORDER_CHANGE — which runs the same logic as VA01/VA02, returns messages in RETURN and leaves commit control to the program. Only if no BAPI exists would I consider BDC (CALL TRANSACTION). The existing inconsistent documents must be analysed and corrected with the functional team.
easyBAPI

2. A material upload reported success because every function module call returned SY-SUBRC = 0, but many materials were not created. What went wrong?

BAPIs normally do not use classic exceptions; they return business errors in the RETURN parameter. SY-SUBRC = 0 only means the call itself completed without an exception. The program never read RETURN, so errors like missing views or invalid values were ignored — and possibly a commit was still issued. The fix: evaluate all RETURN entries after each call (E/A = failure, for BAPI_MATERIAL_SAVEDATA the RETURN is a single structure), commit only on success, roll back otherwise, and log messages per material with ID/number/variables. The report should show per-row results and the status of each material.
mediumBAPI

3. How do you post multiple sales orders in one program transactionally?

Loop through the source data, call the create BAPI once per order, capture RETURN, and only commit after processing the batch. If any critical error occurs, call BAPI_TRANSACTION_ROLLBACK and log the failed rows for later processing.
mediumBAPI

4. An accounting BAPI (BAPI_ACC_DOCUMENT_POST) fails only for one company code. How do you debug it?

I capture the exact payload and RETURN for a failing and a successful company code and compare. RETURN ID/NUMBER usually points to the cause: closed posting period (OB52), missing field status or account settings in that company code, tax code not valid for the country, document type/number range missing, currency or exchange rate type issues. Then I test with BAPI_ACC_DOCUMENT_CHECK in SE37 using the payload, compare customizing between company codes, check authorizations of the posting user (F_BKPF_BUK, via STAUTHTRACE for background users) and any substitutions/validations (GGB0/GGB1, OBBH) or BTE/BAdI extensions active only for that company code. Once found, fix customizing or mapping and add a regression case.
mediumBAPI

5. An upload program claimed to offer a simulation mode by calling the real BAPI and simply not committing. Is this safe? What would you do instead?

Not reliably. Without a commit nothing is saved in the normal case, but locks and registered updates remain until the LUW ends; if any later statement in the same LUW commits (another BAPI, a log write with COMMIT WORK, a function that commits internally), the "simulated" documents are saved. Some BAPIs or exits may also commit or trigger side effects. Better: use the BAPI's TESTRUN parameter or a dedicated check BAPI (e.g. BAPI_ACC_DOCUMENT_CHECK), always followed by BAPI_TRANSACTION_ROLLBACK, and make sure logging uses a separate mechanism that does not commit the main LUW. Use the same mapping code for test and update runs and clearly display results.
mediumBAPI

6. A customer upload of 20,000 records stopped on the first invalid record and nothing was saved. How would you redesign the transaction handling?

The program probably processed all records in one LUW and rolled back (or aborted) at the first error, losing all good records. For uploads, each business document should be its own LUW: call the BAPI, evaluate RETURN, then BAPI_TRANSACTION_COMMIT (WAIT = 'X') on success or BAPI_TRANSACTION_ROLLBACK on error, and continue with the next record. Errors are logged per record with the source row, so users correct only failed rows and rerun them (with idempotency to avoid duplicates). A test-run mode helps catch errors before posting. Messages should never terminate the program (no MESSAGE type E/A inside the loop in background).
mediumBAPI

7. A sales order upload passed valid header and item data but omitted schedule lines and X structures; orders were created with zero quantity or missing values. Explain the mapping rules.

In BAPI_SALESORDER_CREATEFROMDAT2 the order quantity is normally passed via ORDER_SCHEDULES_IN (REQ_QTY) with matching ORDER_SCHEDULES_INX, keyed by ITM_NUMBER and SCHED_LINE; items alone don't carry the requested quantity in the usual pattern. Also, every supplied field needs its 'X' in the corresponding X structure (header, item, schedule) — otherwise the BAPI ignores the value without error. So the mapping must: build consistent keys across items, schedules, conditions and X tables; set UPDATEFLAG; convert values to internal format (ALPHA, units, partner roles AG/WE). I would centralise this in a mapping class with unit tests and verify created orders in QA against the source.
mediumBAPI

8. A cloud application initially planned to call SAP function modules via RFC to create orders. How would you advise on BAPI, RFC or OData?

RFC is a protocol typically used SAP-to-SAP or via SAP connectors; it requires network access to the RFC port, a stateful session for BAPI + commit, and ties the cloud app to function module signatures. For a cloud app, an HTTP-based interface is usually better: a released OData/REST API (e.g. the sales order API in S/4HANA) or an own OData/RAP service that internally uses the BAPI or RAP business object, exposed through an integration platform/API management with proper authentication. If RFC must be used, only released BAPIs, with commit in the same session and handling of communication failures. For high volume or unreliable networks, asynchronous messaging (IDoc, events, queue) is preferable.
mediumBAPI

9. A sales interface populated EXTENSIONIN with a custom header field, but the field is never saved. How do you troubleshoot?

I would check the extension chain: the ZZ field must be appended to VBAK, BAPE_VBAK and VBAKKOZ (same type) and as CHAR1 flag to BAPE_VBAKX and VBAKKOZX. The interface must send two EXTENSIONIN entries: STRUCTURE 'BAPE_VBAK' with VALUEPART1 containing the structure (VBELN empty for create), and 'BAPE_VBAKX' with 'X' for the field. Then debug: breakpoint in the BAPI where BAPE_VBAK is processed (search the source), check the values arriving and whether the move into VBAKKOZ works; non-character fields in VALUEPART and type mismatches shift data. Finally check that no user exit overwrites the field after mapping.
hardBAPI

10. How do you design a robust batch that posts thousands of BAPIs?

Batch source records, process in packages, capture per-record RETURN, commit per package (not per row), log failures to a Z-table with error code, and provide a re-run job for failed rows. Monitor via SM37 and alert on error rate thresholds.
hardBAPI

11. External system floods SAP with BAPI calls. How do you protect performance?

Introduce a queued RFC (qRFC) or a Kafka/Event Mesh consumer that buffers requests, throttle inbound traffic, batch requests server-side, and add circuit breakers. Monitor SMQR/SMQ2 for backlogs.
hardBAPI

12. A middleware interface retried a BAPI-based order creation after an error response, and customers received duplicate orders. How do you design the interface to be retry-safe?

Retries are normal in integrations, so the SAP side must be idempotent. Each request carries a unique external ID; SAP stores it (e.g. in the customer PO number or a custom field) and in a status table. Before calling the BAPI, the program locks the external ID, checks the status table and the documents; if the order exists, it returns the existing number instead of creating a new one. Processing is one LUW per order: BAPI, RETURN evaluation, commit WAIT or rollback, then status update. The response to middleware includes the SAP document number and a clear status. The crash-after-commit case is covered because the existence check finds the document on retry.
hardBAPI

13. A remote interface timed out after creating a goods movement and retried the call, resulting in duplicate postings. What happened and how do you prevent it?

The first call probably completed in SAP — BAPI plus commit — but the response did not reach the caller before its timeout. The caller assumed failure and repeated the call, creating a second material document. Timeouts do not tell whether SAP processed the request. Prevention: make the interface idempotent — send a unique external reference (e.g. in the header text/reference field), check in SAP whether a document with that reference exists before posting, and keep a status table. Commit in the same RFC session with WAIT, align timeouts with realistic runtimes, and for such postings prefer asynchronous, exactly-once mechanisms (tRFC/qRFC/bgRFC, IDoc) with monitoring.

Related lesson

BAPI Part 4: Understanding BAPI RETURN Messages

Related topics

Next practice step

Go deeper on this topic