Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
lina2
Advisor
Advisor
1,894

This blog provides information on the frequently encountered errors when making API calls to create journal entries. The identified issues fall under two main categories: those that return a Service Response with Error code 500 and those returning code 200 yet containing error messages. Here, we highlight some most frequently occurring errors users have been dealing with and how to resolve them. The following errors are  dedicated to APIs Journal Entry - Post (Synchronous) | SAP Help Portal and Journal Entry - Post (Asynchronous) | SAP Help Portal

Error Type 1: Service response with code 500 'Internal Server Error'

Indicates that a request being processed by a data service encountered an unexpected error during processing , normally due to XML format issues.

1.1 Error: <tag name> is not matched

Cause: This error usually occurs when the tags in the API request don't match.

Solution: Ensure all opening tags have a corresponding closing tag.

Example: <BusinessTransactionType>should match with end-tag</BusinessTransactionType>, the following payload, the end-tag is wrongly maintained as </BusinessTransaction> 

Picture1.png

1.2 Error: <tag name>  is incorrect

Cause: The error surfaces when a tag name in the API request is incorrect.

Solution: Ensure all tag names in your API request are correct. Review documentation of parameter names in Journal Entry | SAP Help Portal for correct tag names in .

Example: The correct tag name for cost center is <CostCenter>, for the below payload it wrongly maintained as <Costcenter> 

6.png

 

1.3 Error: Duplicate <tags>

Cause: This error happens when some tags are unnecessarily repeated in the API request.

Solution: Remove duplicate tags from your API request.

Example: duplicated tag <CreatedByUser>  in payload

7.png

 

1.4 Error: URL errors

Cause: The error occurs when the URL specified in the API request is incorrect.

Solution: Ensure your API request is directed to the correct URL. 

Example: 

5.png

Error Type 2: Service response with code 200 'OK', but the journal entries not posted and contains error message.

2.1 Error Message: F5A 400 'Minor difference & & & cannot be allocated across company codes'

Cause: This error typically occurs due to varying currency settings among company codes for cross-company code posting.

Solution: There are two solutions to this error:

  • Deactivate the error message in view V_T100C using T-code SM30. (Customizing of error message is not possible in SAP S/4HANA Public Cloud)
  • Transfer amounts in Group currency by maintaining <AmountInGroupCurrency  currencyCode="">

Example Payload: <AmountInGroupCurrency  currencyCode="USD"> is maintained in cross company code posting.

 

 

 

 

 

                <JournalEntry>
                    <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
                    <OriginalReferenceDocument/>
                    <OriginalReferenceDocumentLogicalSystem/>
                    <BusinessTransactionType>RFBU</BusinessTransactionType>
                    <AccountingDocumentType>SA</AccountingDocumentType>
                    <DocumentReferenceID>123</DocumentReferenceID>
                    <DocumentHeaderText>intercompany_hazel</DocumentHeaderText>
                    <CreatedByUser>HANHAZ</CreatedByUser>
                    <CompanyCode>1710</CompanyCode>
                    <DocumentDate>2024-02-06</DocumentDate>
                    <PostingDate>2024-02-01</PostingDate>
                    <Reference1InDocumentHeader>Cross_Comp</Reference1InDocumentHeader>
                    <Item>
                        <CompanyCode>1710</CompanyCode>
                        <GLAccount>10010000</GLAccount>
                        <AmountInTransactionCurrency currencyCode="USD">100</AmountInTransactionCurrency>
                        <AmountInGroupCurrency  currencyCode="USD">150</AmountInGroupCurrency >
                    </Item>
                    <Item>
                        <CompanyCode>1010</CompanyCode>
                        <GLAccount>10010000</GLAccount>
                        <AmountInTransactionCurrency currencyCode="USD">-100</AmountInTransactionCurrency>
                        <AmountInGroupCurrency  currencyCode="USD">-150</AmountInGroupCurrency >
                    </Item>
                </JournalEntry>

 

 

 

 

 

2.2 Error Message: FINS_FI_POSTING_IF 047 "D/C-Code does not fit to sign of amount in some items"

Cause: This error comes about when there's inconsistency in the sign of the D/C-Code <DebitCreditCode> across all items for one journal entry.

Solution:  For the API, negative posting is on the header level. With this, ensure all items have consistent 'DebitCreditCode'. Normally for D/C-Code, 'S' represents positive amount and 'H' represents negative amount. If negative posting is desired, apply a negative amount for 'S', and a positive amount to 'H', and ensure this logic is followed for all D/C-Codes.

Example Payload: All amount with <DebitCreditCode> S are negative.

 

 

 

 

 

               <JournalEntry>
                    <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
                    <BusinessTransactionType>RMRP</BusinessTransactionType>
                    <AccountingDocumentType>RE</AccountingDocumentType>
                    <DocumentHeaderText>CLEARING_AP_01</DocumentHeaderText>
                    <CreatedByUser>CB9980001180</CreatedByUser>
                    <CompanyCode>{{CompanyCode}}</CompanyCode>
                    <DocumentDate>{{Today}}</DocumentDate>
                    <PostingDate>{{Today}}</PostingDate>
                    <TaxDeterminationDate>{{Today}}</TaxDeterminationDate>
                    <DocumentReferenceID>123</DocumentReferenceID>
                    <Item>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <GLAccount>{{AP_GLAccount}}</GLAccount>
                        <AmountInTransactionCurrency currencyCode="EUR">-1000</AmountInTransactionCurrency>
                        <DebitCreditCode>S</DebitCreditCode>
                        <Tax>
                            <TaxCode>V1</TaxCode>
                        </Tax>
                        <AccountAssignment>
                            <CostCenter>{{CostCenter}}</CostCenter>
                        </AccountAssignment>
                    </Item>
                    <CreditorItem>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <Creditor>{{Creditor}}</Creditor>
                        <AmountInTransactionCurrency currencyCode="EUR">1190</AmountInTransactionCurrency>
                        <DebitCreditCode>H</DebitCreditCode>
                        <DocumentItemText>Vender item</DocumentItemText>
                    </CreditorItem>
                    <ProductTaxItem>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <TaxCode>V1</TaxCode>
                        <DebitCreditCode>S</DebitCreditCode>
                        <AmountInTransactionCurrency currencyCode="EUR">-190</AmountInTransactionCurrency>
                        <TaxBaseAmountInTransCrcy currencyCode="EUR">-1000</TaxBaseAmountInTransCrcy>
                        <ConditionType>MWVS</ConditionType>
                    </ProductTaxItem>
                </JournalEntry>

 

 

 

 

 

2.3 Error Message: FS 214 G/L account & requires a valid tax code

Cause: G/L account is tax relevant, requiring a valid tax code in line item.

Solution: For instant, expense account is set as tax relevant in G/L account master data. Tax code is mandatory for this account. Please maintain <TaxCode>in the item node.

Example Payload: Account 61004000 should have <TaxCode> maintianed in the item node.

 

 

 

 

 

                <JournalEntry>
                    <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
                    <BusinessTransactionType>RMRP</BusinessTransactionType>
                    <AccountingDocumentType>RE</AccountingDocumentType>
                    <DocumentHeaderText>TDD Tax</DocumentHeaderText>
                    <CreatedByUser>CB9980001180</CreatedByUser>
                    <CompanyCode>1010</CompanyCode>
                    <DocumentDate>2024-5-17</DocumentDate>
                    <PostingDate>2024-5-17</PostingDate>
                    <TaxDeterminationDate>2024-5-17</TaxDeterminationDate>
                    <DocumentReferenceID>123</DocumentReferenceID>
                    <Item>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <GLAccount>61004000</GLAccount>
                        <AmountInTransactionCurrency currencyCode="EUR">1000</AmountInTransactionCurrency>
                        <DebitCreditCode>S</DebitCreditCode>
                        <Tax>
                            <TaxCode>V1</TaxCode>
                        </Tax>
                        <AccountAssignment>
                            <CostCenter>10101101</CostCenter>
                        </AccountAssignment>
                    </Item>
                    <CreditorItem>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <Creditor>10300003</Creditor>
                        <AmountInTransactionCurrency currencyCode="EUR">-1190</AmountInTransactionCurrency>
                        <DebitCreditCode>H</DebitCreditCode>
                        <DocumentItemText>Vender item</DocumentItemText>
                    </CreditorItem>
                    <ProductTaxItem>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <TaxCode>V1</TaxCode>
                        <DebitCreditCode>S</DebitCreditCode>
                        <AmountInTransactionCurrency currencyCode="EUR">190</AmountInTransactionCurrency>
                        <TaxBaseAmountInTransCrcy currencyCode="EUR">1000</TaxBaseAmountInTransCrcy>
                        <ConditionType>MWVS</ConditionType>
                    </ProductTaxItem>
                </JournalEntry>

 

 

 

 

 

2.4 Error Message: FOT_TDT 012 For tax code &1, the key date &2 does not fall in any validity period; FOT_TDT 008 Time dependent taxes: tax date has to be filled from caller

Cause: This error occurs when a tax code has various validity periods, requiring a tax determination date for tax rate, in countries where time-dependent tax calculation is active.

Solution: You need to maintain <TaxDeterminationDate> at header level. For details you can also refer  to the blog Posting Journal Entries with Tax Using SOAP Postin... - SAP Community.

Example Payload: There are serveral validaity period for tax code V1, <TaxDeterminationDate> should be maintained in header.

8.png

 

 

 

 

 

                <JournalEntry>
                    <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
                    <BusinessTransactionType>RMRP</BusinessTransactionType>
                    <AccountingDocumentType>RE</AccountingDocumentType>
                    <DocumentHeaderText>TDD Tax</DocumentHeaderText>
                    <CreatedByUser>CB9980001180</CreatedByUser>
                    <CompanyCode>1010</CompanyCode>
                    <DocumentDate>2024-5-17</DocumentDate>
                    <PostingDate>2024-5-17</PostingDate>
                    <TaxDeterminationDate>2024-5-17</TaxDeterminationDate>
                    <DocumentReferenceID>123</DocumentReferenceID>
                    <Item>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <GLAccount>61004000</GLAccount>
                        <AmountInTransactionCurrency currencyCode="EUR">1000</AmountInTransactionCurrency>
                        <DebitCreditCode>S</DebitCreditCode>
                        <Tax>
                            <TaxCode>V1</TaxCode>
                        </Tax>
                        <AccountAssignment>
                            <CostCenter>10101101</CostCenter>
                        </AccountAssignment>
                    </Item>
                    <CreditorItem>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <Creditor>10300003</Creditor>
                        <AmountInTransactionCurrency currencyCode="EUR">-1190</AmountInTransactionCurrency>
                        <DebitCreditCode>H</DebitCreditCode>
                        <DocumentItemText>Vender item</DocumentItemText>
                    </CreditorItem>
                    <ProductTaxItem>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <TaxCode>V1</TaxCode>
                        <DebitCreditCode>S</DebitCreditCode>
                        <AmountInTransactionCurrency currencyCode="EUR">190</AmountInTransactionCurrency>
                        <TaxBaseAmountInTransCrcy currencyCode="EUR">1000</TaxBaseAmountInTransCrcy>
                        <ConditionType>MWVS</ConditionType>
                    </ProductTaxItem>
                </JournalEntry>

 

 

 

 

 

2.5 Error Message: FF 817 Taxes by item is not activated and therefore not permitted in transfer. 

Cause: If tax calculated by line items not active, the tax is determined for the entire document. Tax items should be summarized at the journal entry level. 

Solution: You must summarize tax items at the journal entry level. For instance, for multiple expenditure items with the same tax code, summarize them as one tax item in the ProductTaxItem node.  Please refer to the blog Posting Journal Entries with Tax Using SOAP Postin... - SAP Community

Example Payload: Please refer blog Posting Journal Entries with Tax Using SOAP Postin... - SAP Community Posting Supplier Invoice with Input Tax part.

2.6 Error Message: FF 818 Taxes by item is activated; consequently, transfer by item is mandatory.

Cause: You can activate the passing of tax at the line-by-line level based on your business requirements. If tax is calculated by line items, that means the tax is not determined for the entire document. Instead, it must be determined and posted individually for each expense item or revenue item. 

Solution: For tax at the line item level, Tax Jurisdiction Code is required in the ProductTaxItem node. Tax Item Group is also required and must be identical with the related items. G/L Item has the relevant Tax Item Group parameter in the Tax substructure.   Please refer to the blog Posting Journal Entries with Tax Using SOAP Postin... - SAP Community

Example Payload: Please refer blog Posting Journal Entries with Tax Using SOAP Postin... - SAP Community Tax Calculation by Line items part.

2.7 Error Message: FF 805 tax statement item missing for tax code &. FF 804

Cause: Tax calculation is not supported within API. You will get this error when you not pass all tax line items.

Solution: You need to calculate the tax and pass all relevant parameters of tax line item to the API. Parameters like Tax Code, Tax Classification, Tax Amount, and Tax Base Amount are all required. In the case of simple tax transactions, you need transfer the tax code and the tax amount. However, in the case of more complex transactions (such as multi-level tax codes or for postings with item-by-item tax calculation), you also need to transfer the Tax Classification and condition key. To avoid side effects during tax posting, recommend that you always transfer data for every tax line item.

Example Payload: Please refer blog Posting Journal Entries with Tax Using SOAP Postin... - SAP Community Posting Supplier Invoice with Input Tax part. For an expense item with a tax code that includes multiple tax items

2.8 Error Message: F5 598 Posting keys for account determination for transaction & do not exist

Cause: The error is raised when you're trying to post the journal entry with non-deductible tax code via API. The root cause is due to your configuration: the accounting key ,like 'NVP' ,is maintained as deductible and is set to "Distribute to relevant expense/revenue items" (STBKZ = 3), however the flag of Not deductible STAZF is not set, with this it is expected on a separate line in the tax table. In other processes like FI postings via Fiori Apps or GUI Transactions, the setting STBKZ = 3 is implicitly treated as if Not deductible STAZF is also set, hence why this issue only arises in the API case and not in other transactions.

Wrong configuration for NVP: Not deductible flag is not set.

10.png

Solution: To eliminate this error message, you should set the relevant accounting key NVP to non-deductible under transaction OBCN. For cloud customer, please kindly raise one incident to SAP under component FI-CNT-GL.

Example Payload: Please kindly refer following example, tax code P1 is used with accounting key NVP as non deductive. And for accounting key NVP, posting indicator is set as 3. The payload as following:

 

                <JournalEntry>
                    <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
                    <BusinessTransactionType>RFBU</BusinessTransactionType>
                    <AccountingDocumentType>SA</AccountingDocumentType>
                    <CreatedByUser>HANHAZ</CreatedByUser>
                    <CompanyCode>2910</CompanyCode>
                    <DocumentDate>2024-06-06</DocumentDate>
                    <PostingDate>2024-06-06</PostingDate>
                    <Item>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <GLAccount>10010000</GLAccount>
                        <AmountInTransactionCurrency currencyCode="CAD">1000</AmountInTransactionCurrency>
                        <DebitCreditCode>S</DebitCreditCode>
                        <DocumentItemText>Test Item 1</DocumentItemText>
                    </Item>
                    <Item>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <GLAccount>61003000</GLAccount>
                        <AmountInTransactionCurrency currencyCode="CAD">-952.38</AmountInTransactionCurrency>
                        <DebitCreditCode>H</DebitCreditCode>
                        <DocumentItemText>Test Item 2</DocumentItemText>
                        <AccountAssignment>
                            <CostCenter>29101101</CostCenter>
                        </AccountAssignment>
                        <Tax>
                            <TaxCode>P1</TaxCode>
                            <TaxJurisdiction>CAAB</TaxJurisdiction>
                        </Tax>
                    </Item>
                    <ProductTaxItem>
                        <TaxCode>P1</TaxCode>
                        <TaxItemClassification>VST</TaxItemClassification>
                        <DebitCreditCode>H</DebitCreditCode>
                        <TaxJurisdiction>CA00</TaxJurisdiction>
                        <AmountInTransactionCurrency currencyCode="CAD">-47.62</AmountInTransactionCurrency>
                        <TaxBaseAmountInTransCrcy currencyCode="CAD">1000</TaxBaseAmountInTransCrcy>
                    </ProductTaxItem>
                    <ProductTaxItem>
                        <TaxCode>P1</TaxCode>
                        <TaxItemClassification>NVP</TaxItemClassification>
                        <DebitCreditCode>H</DebitCreditCode>
                        <TaxJurisdiction>CAAB</TaxJurisdiction>
                        <AmountInTransactionCurrency currencyCode="CAD">0.00</AmountInTransactionCurrency>
                        <TaxBaseAmountInTransCrcy currencyCode="CAD">952.38</TaxBaseAmountInTransCrcy>
                    </ProductTaxItem>
                </JournalEntry>

 

 

This blog post is just the starting point. We'll regularly update it with solutions to more frequently occurring, as well as new, error messages. We aim to provide a complete and easy-to-understand guide for troubleshooting journal entry API-related issues.

Stay connected for more updates and solutions that aim to make your API experience as efficient as possible.