Skip to Content
Technical Articles
Author's profile photo Wesley Yin

Guidelines for API Journal Entry – Clearing (Asynchronous)

In this blog post you will learn some constraints, help information about API Journal Entry – Clearing (Asynchronous).

To learn more about Journal Entry APIs at Guidelines for API Journal Entry – Post.

1. Usage

Journal Entry – Clearing (Asynchronous) was delivered in CE1908, which provides asynchronous SOAP API which enable remote systems to clear journal entries in SAP S/4HANA Cloud asynchronously. The service supports G/L account clearing, customer account clearing, and vendor account clearing.

This service contains importing parameter tables for:

  • JournalEntry
  • GLItems
  • APARItems

To learn more about the information of importing parameters at SAP Help Journal Entry – Clearing (Asynchronous).

2. Prerequisite

In order to use this API, you need to firstly configure communication arrangement for communication scenario Finance – Posting Integration (SAP_COM_0002).

Read more at Guidelines for Configuring Communication Scenario Finance – Posting Integration (SAP_COM_0002)

3. How to Test

This  API is SOAP service. I suggest to test it with SOAPUI.

Read more at Guidelines for Testing Journal Entry API with SOAPUI and Checking Response Message

4. How to Check Response Message

As this is asynchronous API, you need to check the response message via Fiori App Message Dashboard.

Read more at Guidelines for Testing Journal Entry API with SOAPUI and Checking Response Message

Since CE2108, we provide Outbound API Journal Entry – Clearing Confirmation (Asynchronous), which is the outbound service of API Journal Entry – Clearing (Asynchronous). By means of this outbound service, the execution result can be sent to the sender system proactively.

Regarding how to enable outbound API in communication arrangement and how to fill in data request, please refer Guidelines for Enabling Outbound API Journal Entry – Change Confirmation (Asynchronous). This Guideline mainly introduce the procedure to use Outbound API Journal Entry – Change Confirmation (Asynchronous), which are the same as Outbound API Journal Entry – Clearing Confirmation (Asynchronous).

5. Important New Features per Release

5.1 Since CE2105, the API supports partial clearing, residual clearing with discount

5.2 Since CE2108, the following new features are enhanced.

  • the API supports residual clearing with distribution by reason codes
  • Journal Entry – Clearing Confirmation (Asynchronous) has been provided to return the results messages of inbound service Journal Entry – Clearing (Asynchronous) to the calling system.

6. Constraints and Consulting Questions

6.1    Constraints

Journal Entry – Clearing API has the following limitations:

  • Cash discount is not supported with partial clearing
  • Residual amount is not supported with partial clearing

7.Appendix

  1. SAP API Business Hub

Journal Entry – Clearing (Asynchronous)

      2. Example Payload

Clear Vendor Invoice with Outgoing Payment and Down Payment

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
   <soapenv:Header/>
   <soapenv:Body>
      <sfin:JournalEntryBulkClearingRequest>
         <MessageHeader>
            <!--Optional:-->
            <ID>MSG_2019-04-28_4.7</ID>
            <CreationDateTime>2019-04-12T12:00:00.1234567Z</CreationDateTime>
            <TestDataIndicator>false</TestDataIndicator>
         </MessageHeader>
         <!--1 or more repetitions:-->
         <JournalEntryClearingRequest>
            <MessageHeader>
               <!--Optional:-->
               <ID>SUB_MSG_2019-04-16_01</ID>
               <CreationDateTime>2019-04-10T12:00:00.1234567Z</CreationDateTime>
               <!--Optional:-->
               <TestDataIndicator/>
            </MessageHeader>
            <JournalEntry>
               <CompanyCode>1010</CompanyCode>
               <AccountingDocumentType>AB</AccountingDocumentType>
               <DocumentDate>2019-04-26</DocumentDate>
               <PostingDate>2019-04-26</PostingDate>
               <CurrencyCode>EUR</CurrencyCode>
               <DocumentHeaderText>Test for Clearing</DocumentHeaderText>
               <CreatedByUser>DAVID</CreatedByUser>
               <!--<AccountingDocument>?</AccountingDocument>-->
               <!--<CurrencyTranslationDate>?</CurrencyTranslationDate>-->
               <!--<FiscalPeriod>?</FiscalPeriod>-->
               <!--<ExchangeRate>?</ExchangeRate>-->
               <DocumentHeaderText>Test for Clearing</DocumentHeaderText>
               <!--<ReferenceDocument>?</ReferenceDocument>-->
               <CreatedByUser>DAVID</CreatedByUser>
               <APARItems>
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <!--<CompanyCode></CompanyCode>-->
                  <AccountType>K</AccountType>
                  <APARAccount>S10300901</APARAccount>
                  <FiscalYear>2019</FiscalYear>
                  <AccountingDocument>1900000959</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
               </APARItems>
               <APARItems>
                  <ReferenceDocumentItem>2</ReferenceDocumentItem>
                  <!--<CompanyCode></CompanyCode>-->
                  <AccountType>K</AccountType>
                  <APARAccount>S10300901</APARAccount>
                  <FiscalYear>2019</FiscalYear>
                  <AccountingDocument>1500000241</AccountingDocument>
                  <AccountingDocumentItem>2</AccountingDocumentItem>
               </APARItems>
               <APARItems>
                  <ReferenceDocumentItem>3</ReferenceDocumentItem>
                  <!--<CompanyCode></CompanyCode>-->
                  <AccountType>K</AccountType>
                  <APARAccount>S10300901</APARAccount>
                  <FiscalYear>2019</FiscalYear>
                  <AccountingDocument>1500000243</AccountingDocument>
                  <AccountingDocumentItem>2</AccountingDocumentItem>
               </APARItems>
            </JournalEntry>
         </JournalEntryClearingRequest>
      </sfin:JournalEntryBulkClearingRequest>
   </soapenv:Body>
</soapenv:Envelope>

 

Clear G/L Accounting Documents

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
   <soapenv:Header/>
   <soapenv:Body>
      <sfin:JournalEntryBulkClearingRequest>
         <MessageHeader>
            <!--Optional:-->
            <ID>MSG_2019-04-30_4.9</ID>
            <CreationDateTime>2019-04-12T12:00:00.1234567Z</CreationDateTime>
            <TestDataIndicator>false</TestDataIndicator>
         </MessageHeader>
         <!--1 or more repetitions:-->
         <JournalEntryClearingRequest>
            <MessageHeader>
               <!--Optional:-->
               <ID>SUB_MSG_2019-04-16_01</ID>
               <CreationDateTime>2019-04-10T12:00:00.1234567Z</CreationDateTime>
               <!--Optional:-->
               <TestDataIndicator/>
            </MessageHeader>
            <JournalEntry>
               <CompanyCode>1010</CompanyCode>
               <AccountingDocumentType>AB</AccountingDocumentType>
               <DocumentDate>2019-04-26</DocumentDate>
               <PostingDate>2019-04-26</PostingDate>
               <CurrencyCode>EUR</CurrencyCode>
               <DocumentHeaderText>Test for Clearing</DocumentHeaderText>
               <CreatedByUser>DAVID</CreatedByUser>
               <!--<AccountingDocument>?</AccountingDocument>-->
               <!--<CurrencyTranslationDate>?</CurrencyTranslationDate>-->
               <!--<FiscalPeriod>?</FiscalPeriod>-->
               <!--<ExchangeRate>?</ExchangeRate>-->
               <DocumentHeaderText>Test for Clearing</DocumentHeaderText>
               <!--<ReferenceDocument>?</ReferenceDocument>-->
               <CreatedByUser>DAVID</CreatedByUser>
               <GLItems>
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <!--<CompanyCode>?</CompanyCode>-->
                  <GLAccount>11001010</GLAccount>
                  <FiscalYear>2019</FiscalYear>
                  <AccountingDocument>100003875</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
               </GLItems>
               <GLItems>
                  <ReferenceDocumentItem>2</ReferenceDocumentItem>
                  <!--<CompanyCode>?</CompanyCode>-->
                  <GLAccount>11001010</GLAccount>
                  <FiscalYear>2019</FiscalYear>
                  <AccountingDocument>100003877</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
               </GLItems>
            </JournalEntry>
         </JournalEntryClearingRequest>
      </sfin:JournalEntryBulkClearingRequest>
   </soapenv:Body>
</soapenv:Envelope>
Partial Clearing

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
   <soapenv:Header/>
   <soapenv:Body>
      <sfin:JournalEntryBulkClearingRequest>
         <MessageHeader>
            <!--Optional:-->
            <ID>MSG_202103_Partial</ID>
            <CreationDateTime>2021-03-02T12:00:00.1234567Z</CreationDateTime>
            <TestDataIndicator>false</TestDataIndicator>
         </MessageHeader>
         <!--1 or more repetitions:-->
         <JournalEntryClearingRequest>
            <MessageHeader>
               <!--Optional:-->
               <ID>MSG_20210302_01</ID>
               <CreationDateTime>2021-03-02T12:00:00.1234567Z</CreationDateTime>
               <TestDataIndicator/>
            </MessageHeader>
            <JournalEntry>
               <CompanyCode>1010</CompanyCode>
               <AccountingDocumentType>DZ</AccountingDocumentType>
               <DocumentDate>2021-03-03</DocumentDate>
               <PostingDate>2021-03-03</PostingDate>
               <CurrencyCode>EUR</CurrencyCode>
               <!--Optional:-->
               <DocumentHeaderText>Clearing API</DocumentHeaderText>
               <!--Optional:-->
               <CreatedByUser>CB9980000435</CreatedByUser>
               <!--Zero or more repetitions:-->
               <APARItems>
                  <!--Optional:-->
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <!--Optional:-->
                  <CompanyCode>1010</CompanyCode>
                  <AccountType>D</AccountType>
                  <APARAccount>1000031</APARAccount>
                  <FiscalYear>2021</FiscalYear>
                  <AccountingDocument>1800000348</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
                  <!--Optional:-->
                  <PartialPaymentAmtInDspCrcy currencyCode="EUR">70</PartialPaymentAmtInDspCrcy>
                  <!--Optional:-->
                  <PaymentDifferenceReason>910</PaymentDifferenceReason>                  
               </APARItems>
               <APARItems>
                  <!--Optional:-->
                  <ReferenceDocumentItem>2</ReferenceDocumentItem>
                  <!--Optional:-->
                  <CompanyCode>1010</CompanyCode>
                  <AccountType>D</AccountType>
                  <APARAccount>1000031</APARAccount>
                  <FiscalYear>2021</FiscalYear>
                  <AccountingDocument>1400001046</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
               </APARItems>               
            </JournalEntry>
         </JournalEntryClearingRequest>
      </sfin:JournalEntryBulkClearingRequest>
   </soapenv:Body>
</soapenv:Envelope>
Residual Clearing with discount

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
   <soapenv:Header/>
   <soapenv:Body>
      <sfin:JournalEntryBulkClearingRequest>
         <MessageHeader>
            <!--Optional:-->
            <ID>MSG_202103_Residual</ID>
            <CreationDateTime>2021-03-12T12:00:00.1234567Z</CreationDateTime>
            <TestDataIndicator>false</TestDataIndicator>
         </MessageHeader>
         <!--1 or more repetitions:-->
         <JournalEntryClearingRequest>
            <MessageHeader>
               <!--Optional:-->
               <ID>MSG_20210312_01</ID>
               <CreationDateTime>2021-03-12T12:00:00.1234567Z</CreationDateTime>
               <TestDataIndicator/>
            </MessageHeader>
            <JournalEntry>
               <CompanyCode>1010</CompanyCode>
               <AccountingDocumentType>DZ</AccountingDocumentType>
               <DocumentDate>2021-03-12</DocumentDate>
               <PostingDate>2021-03-12</PostingDate>
               <CurrencyCode>EUR</CurrencyCode>
               <!--Optional:-->
               <DocumentHeaderText>Clearing API</DocumentHeaderText>
               <!--Optional:-->
               <CreatedByUser>CB9980000435</CreatedByUser>
               <!--Zero or more repetitions:-->
               <APARItems>
                  <!--Optional:-->
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <!--Optional:-->
                  <CompanyCode>1010</CompanyCode>
                  <AccountType>D</AccountType>
                  <APARAccount>1000031</APARAccount>
                  <FiscalYear>2021</FiscalYear>
                  <AccountingDocument>1800000348</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
                  <!--Optional:-->
                  <CashDiscountAmountInDspCrcy currencyCode="EUR">2</CashDiscountAmountInDspCrcy>
                  <!--Optional:-->
                  <OtherDeductionAmountInDspCrcy currencyCode="EUR">-28</OtherDeductionAmountInDspCrcy>
                  <!--Optional:-->
                  <PaymentDifferenceReason>910</PaymentDifferenceReason>                  
               </APARItems>
               <APARItems>
                  <!--Optional:-->
                  <ReferenceDocumentItem>2</ReferenceDocumentItem>
                  <!--Optional:-->
                  <CompanyCode>1010</CompanyCode>
                  <AccountType>D</AccountType>
                  <APARAccount>1000031</APARAccount>
                  <FiscalYear>2021</FiscalYear>
                  <AccountingDocument>1400001046</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
               </APARItems>               
            </JournalEntry>
         </JournalEntryClearingRequest>
      </sfin:JournalEntryBulkClearingRequest>
   </soapenv:Body>
</soapenv:Envelope>
Residual Clearing with Distribution by Reason Codes

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
   <soapenv:Header/>
   <soapenv:Body>
      <sfin:JournalEntryBulkClearingRequest>
         <MessageHeader>
            <!--Optional:-->
            <ID>MSG_RES_Clear_AP_NoWF</ID>
            <CreationDateTime>2019-04-12T12:00:00.1234567Z</CreationDateTime>
            <!--<TestDataIndicator>true</TestDataIndicator>-->
         </MessageHeader>
         <!--1 or more repetitions:-->
         <JournalEntryClearingRequest>
            <MessageHeader>
               <!--Optional:-->
               <ID>SUB_MSG</ID>
               <CreationDateTime>2019-04-10T12:00:00.1234567Z</CreationDateTime>
               <!--Optional:-->
            </MessageHeader>
            <JournalEntry>
               <CompanyCode>1010</CompanyCode>
               <AccountingDocumentType>KZ</AccountingDocumentType>
               <DocumentDate>2021-04-19</DocumentDate>
               <PostingDate>2021-04-19</PostingDate>
               <CurrencyCode>EUR</CurrencyCode>
               <!--Optional:-->
               <!--<AccountingDocument>?</AccountingDocument>-->
               <!--Optional:-->
               <!--<CurrencyTranslationDate>?</CurrencyTranslationDate>-->
               <!--Optional:-->
               <!--<FiscalPeriod>?</FiscalPeriod>-->
               <!--Optional:-->
               <!--<ExchangeRate>?</ExchangeRate>-->
               <!--Optional:-->
               <DocumentHeaderText>Residual Clearing w Dist</DocumentHeaderText>
               <!--Optional:-->
               <ReferenceDocument>RES Clear</ReferenceDocument>
               <!--Optional:-->
               <CreatedByUser>APITEST</CreatedByUser>
               <APARItems>
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <!--<CompanyCode></CompanyCode>-->
                  <AccountType>K</AccountType>
                  <APARAccount>S10300901</APARAccount>
                  <FiscalYear>2021</FiscalYear>
                  <AccountingDocument>1900000124</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
                  <!--Optional:-->
                  <!--<PartialPaymentAmtInDspCrcy currencyCode="EUR">30</PartialPaymentAmtInDspCrcy>-->
                  <!--Optional:-->
                  <!--<CashDiscountAmountInDspCrcy currencyCode="?">20</CashDiscountAmountInDspCrcy>-->
                  <!--Optional:-->
                  <OtherDeductionAmountInDspCrcy currencyCode="EUR">-200</OtherDeductionAmountInDspCrcy>
                  <!--Optional:-->
                  <!--<PaymentDifferenceReason>910</PaymentDifferenceReason>-->
                  <!--Zero or more repetitions:-->
                  <PaymentDifferenceDistribution>
                     <PaymentDifferenceReason>910</PaymentDifferenceReason>
                     <OtherDeductionAmountInDspCrcy currencyCode="?">-120</OtherDeductionAmountInDspCrcy>
                     <!--Optional:-->
                     <Reference1IDByBusinessPartner>AB1234567890</Reference1IDByBusinessPartner>
                     <!--Optional:-->
                     <Reference2IDByBusinessPartner>BA1234567890</Reference2IDByBusinessPartner>
                  </PaymentDifferenceDistribution>
                  <PaymentDifferenceDistribution>
                     <PaymentDifferenceReason>920</PaymentDifferenceReason>
                     <OtherDeductionAmountInDspCrcy currencyCode="?">-50</OtherDeductionAmountInDspCrcy>
                     <!--Optional:-->
                     <Reference1IDByBusinessPartner>AB1234567890</Reference1IDByBusinessPartner>
                     <!--Optional:-->
                     <Reference2IDByBusinessPartner>BA1234567890</Reference2IDByBusinessPartner>
                  </PaymentDifferenceDistribution>
                  <PaymentDifferenceDistribution>
                     <PaymentDifferenceReason>930</PaymentDifferenceReason>
                     <OtherDeductionAmountInDspCrcy currencyCode="?">-30</OtherDeductionAmountInDspCrcy>
                     <!--Optional:-->
                     <Reference1IDByBusinessPartner>AB1234567890</Reference1IDByBusinessPartner>
                     <!--Optional:-->
                     <Reference2IDByBusinessPartner>BA1234567890</Reference2IDByBusinessPartner>
                  </PaymentDifferenceDistribution>
               </APARItems>
               <APARItems>
                  <ReferenceDocumentItem>2</ReferenceDocumentItem>
                  <!--<CompanyCode></CompanyCode>-->
                  <AccountType>K</AccountType>
                  <APARAccount>S10300901</APARAccount>
                  <FiscalYear>2021</FiscalYear>
                  <AccountingDocument>1500000026</AccountingDocument>
                  <AccountingDocumentItem>1</AccountingDocumentItem>
                  <!--Optional:-->
                  <!--<PartialPaymentAmtInDspCrcy currencyCode="?">?</PartialPaymentAmtInDspCrcy>-->
               </APARItems>
            </JournalEntry>
         </JournalEntryClearingRequest>
      </sfin:JournalEntryBulkClearingRequest>
   </soapenv:Body>
</soapenv:Envelope>

Assigned tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Aniello Cipriano
      Aniello Cipriano

      Hi Yin,

      thanks a lot for your explanation. I have a question :

      If I have a customer invoice with two item, so with net due date 30/60 dd

      01  Customer XXXX   30.11.YY   item 1

      01 Customer XXXX    30.12.YY   item 2

       

      From external system I pay only item 1, can I use this API to post incoming payment + clearing of first item of invoice?

      Thanks for your cooperation

      Author's profile photo Aniello Cipriano
      Aniello Cipriano

      Hi Yin, in your example 'Clear Vendor Invoice with outgoing payment' where is the Bank Account?

      thanks

      Author's profile photo Bhaskar sap
      Bhaskar sap

      Hi Wesley,

      Clear Vendor Invoice with Outgoing Payment & Down payment - There is No Bank account line item for outgoing payment with invoice clearing and No Spl Gl indocator to clear advance against invoice. I don't believe this payload will work without this details.

      Can you advise a payload for Advance against invoice clearing (Full & Partial) & Payment against invoice clearing.

       

      Thanks,