Symptom
When posting inter-company journal entries, in case the header company code differs from company code in 1st line item, error F5A296 "First posting item is not in leading company code ****" is issued in app Post General Journal Entries, but no error with API Journal Entry - Post (BAPI_ACC_DOCUMENT_POST) and journal entry gets posted.
Environment
SAP S/4HANA Cloud.
Cause
The semantics of Header Company Code is different in two cases:
- BAPI_ACC_DOCUMENT_POST
The field is only used to default the company code in the line items in which it was not specified. The leading company code is always the company code of the first line item. - Manual posting
This is the leading company code.
Resolution
It is standard behavior that error is issued in app Post General Journal Entries only, BAPI_ACC_DOCUMENT_POST is not an exact reproduction of the manual app and it has its own posting logic which may differ from manual posting.
Keywords
F5A296, Post General Journal Entries, Journal Entry - Post, API, BAPI_ACC_DOCUMENT_POST, "First posting item is not in leading company code ####". , KBA , AC-INT , Accounting Interface , FI-GL-GL-A , Posting/Clearing , Problem
SAP Knowledge Base Article - Public