# Journal Interface from External Systems with Account Mapping

> A general-purpose interface that converts transactions from non-SAP systems such as a hotel management system, insurance, payroll or a front-office accounting package into SAP G/L accounts, cost centers, customers and vendors through mapping tables, checks them, posts them as accounting documents and emails errors to the owners.

- Type: Program, Custom development, Interface
- Module: FI
- Estimated effort: L (10–15 working days)
- Last updated: 2026-11-18
- URL: https://nekuhub.com/en/programs/journal-interface-from-external-systems-with-account-mapping/


## Why is the standard not enough?

FB50 and FB01 enter postings by hand; LSMW or standard accounting APIs can create documents from a file. But maintenance screens that translate the source system's own account codes, departments and partner codes to their SAP equivalents, pre-posting checks on period, balance and validity, error tracking per source system and reprocessing do not come ready. A separate upload is written for each new source and errors cannot be followed up.

### Closest standard alternatives

- FB50: Enters G/L postings by hand; no mapping or bulk checks.
- LSMW: Can create documents from a file; offers no mapping maintenance per source, error notification or reprocessing.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| SKB1 | Whether the G/L account is open for posting in the company code | Read | SKB1-SAKNR = eşlenen ana hesap | ECC + S/4 |
| CSKS | Cost center validity | Read | CSKS-KOSTL = eşlenen masraf yeri | ECC + S/4 |
| KNB1 | Company code data of the mapped customer | Read | - | ECC + S/4 |
| LFB1 | Company code data of the mapped vendor | Read | - | ECC + S/4 |
| BKPF | Created accounting documents; duplicate reference check | Read / write | BKPF-XBLNR = kaynak belge numarası | ECC + S/4 |
| BSEG | Document items (written through the BAPI) | Write | BSEG-BUKRS = BKPF-BUKRS AND BSEG-BELNR = BKPF-BELNR | ECC + S/4 |
| BALHDR | Interface run log | Write | - | ECC + S/4 |
| T001 | Company code currency and chart of accounts | Read | - | ECC + S/4 |

## BAPIs and functions used

- FI_PERIOD_CHECK: Checks that the posting period is open
- BAPI_ACC_DOCUMENT_CHECK: Checks the document without posting
- BAPI_ACC_DOCUMENT_POST: Posts the accounting document
- BAPI_TRANSACTION_COMMIT: Saves successful documents
- SO_DOCUMENT_SEND_API1: Emails the error summary

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_SRC | Source system code | Single value | - | Yes |
| P_BUKRS | Company code | Single value | BKPF-BUKRS | Yes |
| P_FILE | File (if not read from the interface table) | Single value | - | No |
| S_BUDAT | Posting date | Range / multiple | BKPF-BUDAT | No |
| P_REPR | Reprocess failed and mapping-pending records | Checkbox | - | No |
| P_TEST | Test mode | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Source document number | Voucher number in the source system; written to the SAP reference field | Yes |
| Document date | BKPF-BLDAT | Yes |
| External account code | Converted to an SAP G/L account with the mapping table | Yes |
| External department | Converted to a cost center with the mapping table | No |
| External partner code | Converted to a customer or vendor with the mapping table | No |
| Debit/credit | BSEG-SHKZG | Yes |
| Amount | BSEG-WRBTR | Yes |
| Currency | BKPF-WAERS | Yes |
| Text | BSEG-SGTXT | No |

## Result list columns

| Column | Source |
|---|---|
| Source document number | Calculated: Voucher number in the source system |
| G/L account | BSEG-HKONT |
| Cost center | BSEG-KOSTL |
| Amount | BSEG-WRBTR |
| Accounting document | BKPF-BELNR |
| Status | Calculated: Posted, mapping pending, duplicate or error |
| Message | Calculated: Check or BAPI return message |

## How does the program work?

1. A source code is defined for each source system (for example hotel, payroll, insurance): file format or interface, document type, posting date rule and error recipients.
2. Mapping tables are maintained per source code: external account → SAP G/L account (SKB1), external department → cost center or profit center (CSKS), external partner code → customer or vendor (KNB1, LFB1). A record without a mapping stays in status 'mapping pending'.
3. Pre-posting checks: is the period open (FI_PERIOD_CHECK), is the account open for posting, is the cost center valid (CSKS-DATBI), does the document balance; then BAPI_ACC_DOCUMENT_CHECK runs.
4. Records that pass are posted with BAPI_ACC_DOCUMENT_POST; the source system's document number is written to the reference field (XBLNR) and posting the same reference twice is blocked.
5. The result of each run is written to the application log (BALHDR) and the interface table. Failed and mapping-pending records are sent as a summary to the recipients defined per source code with SO_DOCUMENT_SEND_API1.
6. The monitor lists records by source, date and status; after mapping is completed the selected records are processed again. In S/4HANA the same logic can also be fed through the released journal entry API.

## Authorization objects

- F_BKPF_BUK: Posting authorization for the company code
- F_BKPF_BLA: Posting authorization with the interface document type
- F_BKPF_KOA: Posting authorization by account type

## Frequently asked questions

### If the source system calculates VAT, how are tax lines handled?

If the source sends amounts with tax, the tax code is taken from the mapping table and the BAPI calculates the tax line in SAP, or uses the source tax amount after checking it. The approach is chosen per source system during installation.

### Does adding a new source system require code changes?

If the file format fits one of the existing templates, only the source code and mapping tables are maintained. For a different format or a direct interface a new class is added to the reading layer.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=fi-external-system-journal-interface
