How to Upload General Journal Entries into SAP
In this article
- What file format does SAP require for journal entry upload?
- How do I set up an LSMW project for general journal entries?
- Can I use BAPI_ACC_DOCUMENT_POST for bulk uploads?
- What are the batch size limits and performance tips?
- How do I verify that the uploaded entries are correct?
- What common errors occur and how to fix them?
Upload general journal entries into SAP by preparing a CSV or Excel file and processing it with LSMW, BAPI_ACC_DOCUMENT_POST, or transaction FB50.
Many users assume they can paste rows directly into FB01; the correct approach is to use an import tool such as LSMW or a BAPI to handle bulk data safely.
What file format does SAP require for journal entry upload?
SAP accepts plain‑text CSV files encoded in UTF‑8 or Excel workbooks saved as .xlsx. Each row must contain the fields required by the posting object.
- Document Date (YYYYMMDD)
- Posting Date (YYYYMMDD)
- Company Code (e.g., 1000)
- Currency (e.g., USD)
- G/L Account (e.g., 400000)
- Amount (positive number)
- Debit/Credit indicator (D or C)
- Document Header Text
Keep column headings in the first row; SAP ignores them during import. Do not include formulas or merged cells, as they cause parsing errors.
How do I set up an LSMW project for general journal entries?
LSMW (Legacy System Migration Workbench) is the most common tool for one‑time or periodic bulk uploads.
- Open transaction
LSMWand create a new project, sub‑project, and object. Name them meaningfully, for example JOURNAL_UPLOAD. - Select “Standard Batch/Direct Input” as the method.
- Choose object “0010 – General Ledger”.
- Define the source structure: add fields that match your CSV columns.
- Map each source field to the corresponding SAP field (e.g.,
BUDATfor Document Date,BLDATfor Posting Date,BUKRSfor Company Code,WRBTRfor Amount,SHKZGfor Debit/Credit). - Save the mapping and generate the conversion program.
- On the “Read Data” screen, specify the full path to your CSV file and the delimiter (comma). Set the file encoding to UTF‑8.
- Run the “Convert Data” step; LSMW will create a preview file showing the SAP‑ready format.
- If the preview looks correct, execute the “Create Batch Input Session” step. SAP will open transaction
SM35with a new batch session. - In
SM35, process the session in foreground mode to watch each posting, or in background mode for faster execution.
Typical batch size: up to 10,000 rows per session works reliably on most systems. Larger files may need to be split into 5,000‑row chunks to avoid memory bottlenecks.
Can I use BAPI_ACC_DOCUMENT_POST for bulk uploads?
BAPI_ACC_DOCUMENT_POST is a function module that posts a single document. To use it for many entries, you wrap the call in a custom ABAP program or a remote script.
- Write an ABAP report that reads your CSV file line by line (use
OPEN DATASETwithFOR INPUT IN TEXT MODE). - For each line, populate a structure of type
BAPIACGL09(line items) and a header structure of typeBAPIACHE09. - Call
BAPI_ACC_DOCUMENT_POSTwith the populated structures. - Check the return table
RETURNfor type ‘E’ (error) or ‘W’ (warning). Log any failures for later review. - Commit the work after a reasonable batch, e.g., every 200 documents, using
BAPI_TRANSACTION_COMMIT.
When using a remote language such as Python, the SAP NetWeaver RFC SDK or the pyrfc library can call the same BAPI. Keep the payload under 2 MB per call to stay within typical RFC limits.
What are the batch size limits and performance tips?
Performance depends on system load, network latency, and the number of line items per document.
- Maximum rows per LSMW session: about 10,000; split larger files.
- Maximum RFC payload per call: roughly 2 MB; batch 150‑200 lines per BAPI call.
- Posting a document with more than 30 line items can increase processing time; consider breaking large documents into separate postings.
Tips to improve speed:
- Disable unnecessary checks in LSMW (e.g., set “Update mode” to “Background” if you do not need immediate validation).
- Run the import during off‑peak hours to reduce lock contention on the GL tables.
- Use a dedicated SAP user with the “SAP_ALL” role for testing, then switch to a production‑ready user with only the required authorizations.
- Archive the CSV file after a successful run; keep a copy for audit purposes.
How do I verify that the uploaded entries are correct?
After the import, run a simple report to compare the source file with the created documents.
- Open transaction
FB03and display a few random document numbers from the batch session. - Check that the amounts, accounts, and dates match the source rows.
- Use transaction
FBL3N(G/L Account Line Items) filtered by company code and posting date range to see the total posted amount. - Run a reconciliation: sum the “Amount” column in your CSV and compare it with the total in
FBL3N. The two totals should be identical.
If discrepancies appear, review the LSMW conversion log (transaction SLG1) or the BAPI return table for error messages. Common causes include missing mandatory fields, wrong currency code, or mismatched decimal separators.
What common errors occur and how to fix them?
Understanding typical failures saves time.
- Missing mandatory field: SAP will reject the line and log an ‘E’ message. Add the missing column to the CSV and re‑run the import.
- Incorrect date format: SAP expects YYYYMMDD. Convert any “DD/MM/YYYY” entries before uploading.
- Decimal separator mismatch: Use a period (.) for decimals; a comma will be interpreted as a thousands separator and cause amount errors.
- Authorization errors: The user must have
F_BKPF_BEDandF_BKPF_BESauthorizations. Request the appropriate roles from your security team.
To resolve an error, open the LSMW log, locate the line number, correct the source file, and repeat the conversion step only for the affected rows. This selective re‑run avoids re‑posting already successful entries.