Enterprise Resource Planning Blog Posts 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
4,604

Exploring the potential of the Clearing API Journal Entry – Clearing (Asynchronous) | SAP Help Portal can be an exciting journey for many of our customers. However, understanding its diverse functionality, distinguishing it from Fiori's clearing apps and preparing payloads might be complex. To ease this process, we've compiled this user-friendly guide. It provides clearer insights into the functions and capabilities of the Clearing API and guides you on how to use it effectively to simplify your financial transactions.

Business context:

Before we look into Clearing API, it's essential to know what Open Item Management and Clearing are.

Open items are incomplete business transactions. Clearing is the transaction when an offset value is posted to an item or a group of items, so that the resulting balance of the items is zero. Clearing transactions always create clearing entries.

To better understand, we take the examples in area of AR(Accounts Receivable), AP(Accounts Payable) and G/L(General Ledge).

 In AR accounting, the customer Invoice create open items. When make payments, these open items get cleared, resulting in a zero balance. For more information, please see Clearing of Open Items | SAP Help Portal

In AP accounting, vendor invoices generate open items. When make the payments, these open items get settled. Clearing result in a zero balance. More details can be found Clear Outgoing Payments | SAP Help Portal

In G/L - Consider an account like a bank transfer account. It remains an open item until a bank statement is obtained and cleared. More details can be found Clear G/L Accounts | SAP Help Portal  and Open Item Management for G/L Accounts | SAP Help Portal

Scope of the Clearing API:

The Clearing API is designed to manage the clearing of open items for the general ledger, accounts receivable, and accounts payable. However, it's important to note that this API only supports the clearing function and does not offer the ability to combine posting with clearing in a single step.

In accounts receivable, for instance, the customer invoice and incoming payment posting may not be automatically cleared. That's where Clearing API comes in. It clears the open items of customer invoices and incoming payments. Nonetheless, with the "Post Incoming Payments " app, you can post incoming payment and clear customer invoice in on step Post Incoming Payments | SAP Help Portal

Similar situation that for account payable, you can clear the outgoing payment and vendor invoice with Clearing API. But you can not post the payment and clear the vendor open item in one step, as app  Post Outgoing Payments | SAP Help Portal.

Using the Clearing API in Different Business Scenarios:

1.G/L Clearing:

  • Use case: Consider a situation where a bank transfer account is set up for open item management. In this scenario, when a payment is made, it gets posted to the bank transfer account as an open item. This open item only gets cleared when a corresponding bank statement is received and posted.
  • Sample Documents: Account 11001010 is defined as bank clearing account. Before clearing, there are 2 open items from Payment and  Bank Statement.1-1.pngAfter clearing, both open items are cleared and clearing document generated.1-2.png
  • Sample Payload: Please provide the open items in the node <GLItems> 

 

<JournalEntry>
                    <CompanyCode>{{CompanyCode}}</CompanyCode>
                    <AccountingDocumentType>SA</AccountingDocumentType>
                    <DocumentDate>{{Today}}</DocumentDate>
                    <PostingDate>{{Today}}</PostingDate>
                    <CurrencyCode>EUR</CurrencyCode>
                    <DocumentHeaderText>Full Clearing</DocumentHeaderText>
                    <ReferenceDocument>Full Clear</ReferenceDocument>
                    <CreatedByUser>APITEST</CreatedByUser>
                    <GLItems>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <GLAccount>{{GL_OPEN_GLAccount}}</GLAccount>
                        <FiscalYear>{{Year}}</FiscalYear>
                        <AccountingDocument>{{GL_Journal_Entry_01}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    </GLItems>
                    <GLItems>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <GLAccount>{{GL_OPEN_GLAccount}}</GLAccount>
                        <FiscalYear>{{Year}}</FiscalYear>
                        <AccountingDocument>{{GL_Journal_Entry_02}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    </GLItems>
                </JournalEntry>​

 

2. AR/AP full Clearing:

  • Use case: In this scenario, the vendor invoice and its corresponding payment are both open items. The vendor invoice is fully cleared with the payment, which matches the invoice amount exactly.
  • Sample Documents: Before clearing, there are 2 open items for the vendor, one for invoice and one for payment.1-Picture1.pngAfter clearing, both vendor invoice and payment are cleared, clearing document created.2-Picture2.png
  •  Sample Payload:

    Please put vendor invoice and payment open items in the <APARItems> Node

 

                <JournalEntry>
                    ………
                    <APARItems>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{PaymentEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    </APARItems>
                    <APARItems>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{InvoiceEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    </APARItems>
                   <APARItems>
                     ……
                  </APARItems>
                </JournalEntry>
​

 

3. Payment Differences - Partial Payment:

  • Use case: In an Accounts Receivable scenario, if a customer pays less than the invoiced amount, you'll need to address the payment difference. Both the original invoice and the partial payment remain as open items on the account until the complete payment is made. You can provide a reason for this partial payment, especially if you're using a predefined reason code. Ideally, ensure the 'Charge Off' indicator isn't active.  Similar situation for account payable. For more details please refer Partial Payments Versus Residual Items | SAP Help Portal
  • Sample Journal Entries: Before clearing, there are 2 open items, one for vendor invoice and one for payment.3-Picture3.pngAfter partial clearing, open item for partial payment and invoice are not cleared. 5-Picture5.png4-Picture4.png
  • Sample Payload: You need to put  the vendor invoice and partial payment open items in the <APARItem>Node, and for invoice open item, please also provide partial payment amount in </PartialPaymentAmtInDspCrcy>

 

<JournalEntry>
                    ………
                    <APARItems>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{PaymentEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    </APARItems>
                    <APARItems>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{InvoiceEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    <PartialPaymentAmtInDspCrcy currencyCode=“EUR">4000</PartialPaymentAmtInDspCrcy>
                    </APARItems>
                   <APARItems>
                     ……
                  </APARItems>
                </JournalEntry>​

 

4Residual Items with Payment Difference:

  • Use Case: If you post a residual item, the initial invoice and the payment are cleared and a new open item with reference to the original invoice is created. You can either enter your own short text to explain the reason or use a predefined reason code. Note that you must use a reason code for which the Charge Off indicator has not been set.
  • Sample Documents:  Before clearing open items for invoice and payment as following:6-Picture6.pngAfter Clearing, New open item with residue amount generated.7-Picture7.png
  • Sample Payload: Please provide the payment difference amount in <OtherDeductionAmountInDspCrcy> and reason code in<PaymentDifferenceReason> , the reason code without Charge Off indicator.

 

                <JournalEntry>
                    ………
                    <APARItems>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{PaymentEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    </APARItems>
                    <APARItems>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{InvoiceEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                   <OtherDeductionAmountInDspCrcy currencyCode="EUR">-300</OtherDeductionAmountInDspCrcy>
                   <PaymentDifferenceReason>050</PaymentDifferenceReason>
                    </APARItems>
                   <APARItems>
                     ……
                  </APARItems>
                </JournalEntry> 

 

5.Residual Items using Write-Off Reason Codes:

    • Use Case: Charge Off indicator has been set for the reason code you choose, the payment difference is charged off to a separate G/L account instead. For more details, please kindly check Reason Codes | SAP Help Portal.
    • Sample Documents: Before clearing, there are open items for invoice and payment.

8-Picture8.png

    After clearing, both invoice and payment cleared, the difference post to sperate G/L account.

9-Picture9.png

  • Sample Payload

 

                <JournalEntry>
                    ………
                    <APARItems>
                        <ReferenceDocumentItem>1</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{PaymentEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                    </APARItems>
                    <APARItems>
                        <ReferenceDocumentItem>2</ReferenceDocumentItem>
                        <AccountType>K</AccountType>
                        <APARAccount>1041</APARAccount>
                        <FiscalYear>2024</FiscalYear>
                        <AccountingDocument>{{InvoiceEntry}}</AccountingDocument>
                        <AccountingDocumentItem>1</AccountingDocumentItem>
                        <OtherDeductionAmountInDspCrcy currencyCode="EUR">-1000</OtherDeductionAmountInDspCrcy>
                        <PaymentDifferenceDistribution>
                            <PaymentDifferenceReason>050</PaymentDifferenceReason>
                            <OtherDeductionAmountInDspCrcy currencyCode="EUR">-400</OtherDeductionAmountInDspCrcy>
                        </PaymentDifferenceDistribution>
                        <PaymentDifferenceDistribution>
                            <PaymentDifferenceReason>040</PaymentDifferenceReason>
                            <OtherDeductionAmountInDspCrcy currencyCode="EUR">-600</OtherDeductionAmountInDspCrcy>
                        </PaymentDifferenceDistribution>
                    </APARItems>
                   <APARItems>
                     ……
                  </APARItems>
                </JournalEntry>

 

This guide has been specifically designed to help you maximize the use of the Clearing API while minimizing potential issues, ultimately resulting in a more efficient accounting process. As we continue to evolve this guide, expect to see additional relevant business scenarios for a richer understanding and smoother financial journey.

2 Comments