Introduction

How do you create Down Payment(s) in SAP S/4Hana Cloud ( Public Edition) using APIs? If you dig into SAP Business Accelerator Hub you wont get any direct answers. But if you search further, you will end up with this guide for Journal Entry API on SAP Community Site : User Guide for Journal Entry Post API on S/4 HANA Cloud. But if you follow the example from this post, you might not be successful in creating a Down Payment.

Solution

SAPs documentation on help.sap.com for Journal Entry API seems to have the answer for this . If you dig into the documentation here, you will notice the documentation stating use AZAF  for Business Transaction Type. This seems to have been a recent update and thats where the trick to create Down Payment lies.

Considerations for Down Payment via Journal Entry API

Below fields are essential when you want to post a Journal Entry for Down Payments via the Journal Entry API

SegmentFieldValue
JournalEntryBusinessTransactionTypeAZAF
JournalEntryAccountingDocumentTypeKZ
CreditorItem – CashDiscountTermsDueCalculationBaseDateDueDate in YYYY-MM-DD
CreditorItem – CashDiscountTermsCashDiscount1Days
CashDiscount1Percent
CashDiscount2Days
CashDiscount2Percent
NetPaymentDays
Provide appropriate values for these fields
DownPaymentTermsSpecialGLCodeF
Only F is supported as of writing this post.
Fields for Journal Entry Post API for DownPayment

Example Request

SOAP XML Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
   <soapenv:Header/>
   <soapenv:Body>
      <sfin:JournalEntryBulkCreateRequest>
         <MessageHeader>
            <ID>MSG_2023-06-13</ID>
            <CreationDateTime>2023-06-13T12:00:00.1234567Z</CreationDateTime>
            <TestDataIndicator>false</TestDataIndicator>
         </MessageHeader>
         <!--1 or more repetitions:-->
         <JournalEntryCreateRequest>
            <MessageHeader>
               <ID>SUB_MSG_2023-06-13</ID>
               <TestDataIndicator>false</TestDataIndicator>
               <CreationDateTime>2023-06-13T12:00:00.1234567Z</CreationDateTime>
            </MessageHeader>
            <JournalEntry>
               <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
               <BusinessTransactionType>AZAF</BusinessTransactionType>
               <AccountingDocumentType>KZ</AccountingDocumentType>
               <DocumentHeaderText>Test DownPayment</DocumentHeaderText>
               <CreatedByUser>CPI</CreatedByUser>
               <CompanyCode>XXXX</CompanyCode>
               <DocumentDate>2023-11-14</DocumentDate>
               <PostingDate>2023-11-14</PostingDate>
               <CreditorItem>
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <Creditor>XXXXXXX</Creditor>
                  <AmountInTransactionCurrency currencyCode="EUR">-550.00</AmountInTransactionCurrency>
                  <DebitCreditCode>H</DebitCreditCode>
                  <DocumentItemText>Vender item</DocumentItemText>
                  <CashDiscountTerms>
                     <DueCalculationBaseDate>2023-11-28</DueCalculationBaseDate>
                     <CashDiscount1Days>0</CashDiscount1Days>
                     <CashDiscount1Percent>0</CashDiscount1Percent>
                     <CashDiscount2Days>0</CashDiscount2Days>
                     <CashDiscount2Percent>0</CashDiscount2Percent>
                     <NetPaymentDays>0</NetPaymentDays>
                  </CashDiscountTerms>
                  <DownPaymentTerms>
                     <SpecialGLCode>F</SpecialGLCode>
                  </DownPaymentTerms>
               </CreditorItem>
            </JournalEntry>
         </JournalEntryCreateRequest>
      </sfin:JournalEntryBulkCreateRequest>
   </soapenv:Body>
</soapenv:Envelope>

SOAP XML Response

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header/>
   <soap-env:Body>
      <n0:JournalEntryBulkCreateConfirmation xmlns:n0="http://sap.com/xi/SAPSCORE/SFIN" xmlns:prx="urn:sap.com:proxy:ITL:/1SAI/TAS3D871C7855B59197A671:793">
         <MessageHeader>
            <UUID>03537d79-0b52-1ede-a2bf-e181902c8e10</UUID>
            <ReferenceID>MSG_2023-06-13</ReferenceID>
            <CreationDateTime>2023-11-23T12:51:41.318969Z</CreationDateTime>
            <SenderBusinessSystemID>XXX</SenderBusinessSystemID>
         </MessageHeader>
         <ConfirmationInterfaceOrignName/>
         <JournalEntryCreateConfirmation>
            <MessageHeader>
               <UUID>03537d79-0b52-1ede-a2bf-e181902cae10</UUID>
               <ReferenceID>SUB_MSG_2023-06-13</ReferenceID>
               <CreationDateTime>2023-11-23T12:51:41.318992Z</CreationDateTime>
            </MessageHeader>
            <JournalEntryCreateConfirmation>
               <AccountingDocument>1500000021</AccountingDocument>
               <CompanyCode>XXXX</CompanyCode>
               <FiscalYear>2023</FiscalYear>
            </JournalEntryCreateConfirmation>
            <Log>
               <MaximumLogItemSeverityCode>1</MaximumLogItemSeverityCode>
               <Item>
                  <TypeID>605(RW)</TypeID>
                  <SeverityCode>1</SeverityCode>
                  <Note>Document posted successfully: BKPFF 1500000021XXXX2023</Note>
                  <WebURI></WebURI>
               </Item>
            </Log>
         </JournalEntryCreateConfirmation>
         <Log/>
      </n0:JournalEntryBulkCreateConfirmation>
   </soap-env:Body>
</soap-env:Envelope>

Request / Response In SOAP UI

Down Payment Creation  in SOAP UI in S/4Hana Cloud Public Edition

Down Payment in S/4Hana Public Cloud Edition

Down Payment Request S/4 Hana Public  Cloud

Down Payment with Taxes

SOAP XML Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
   <soapenv:Header/>
   <soapenv:Body>
      <sfin:JournalEntryBulkCreateRequest>
         <MessageHeader>
            <ID>MSG_2023-06-13</ID>
            <CreationDateTime>2023-06-13T12:00:00.1234567Z</CreationDateTime>
            <TestDataIndicator>false</TestDataIndicator>
         </MessageHeader>
         <!--1 or more repetitions:-->
         <JournalEntryCreateRequest>
            <MessageHeader>
               <ID>SUB_MSG_2023-06-13</ID>
               <TestDataIndicator>false</TestDataIndicator>
               <CreationDateTime>2023-06-13T12:00:00.1234567Z</CreationDateTime>
            </MessageHeader>
            <JournalEntry>
               <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
               <BusinessTransactionType>AZAF</BusinessTransactionType>
               <AccountingDocumentType>KZ</AccountingDocumentType>
               <DocumentReferenceID>XXXX</DocumentReferenceID>
               <DocumentHeaderText>XXXX</DocumentHeaderText>
               <CreatedByUser>CPI</CreatedByUser>
               <CompanyCode>XXXX</CompanyCode>
               <DocumentDate>2023-12-15</DocumentDate>
               <PostingDate>2023-12-15</PostingDate>
               <TaxDeterminationDate>2023-12-15</TaxDeterminationDate>
               <CreditorItem>
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <Creditor>XXXX</Creditor>
                  <AmountInTransactionCurrency currencyCode="EUR">-1783.81</AmountInTransactionCurrency>
                  <DebitCreditCode>H</DebitCreditCode>
                  <DocumentItemText>XXXX_XXXX</DocumentItemText>
                  <CashDiscountTerms>
                     <DueCalculationBaseDate>2023-12-15</DueCalculationBaseDate>
                     <CashDiscount1Days>0</CashDiscount1Days>
                     <CashDiscount1Percent>0</CashDiscount1Percent>
                     <CashDiscount2Days>0</CashDiscount2Days>
                     <CashDiscount2Percent>0</CashDiscount2Percent>
                     <NetPaymentDays>0</NetPaymentDays>
                  </CashDiscountTerms>
                  <DownPaymentTerms>
                     <SpecialGLCode>F</SpecialGLCode>
                     <TaxCode>V7</TaxCode>
                  </DownPaymentTerms>
               </CreditorItem>
            </JournalEntry>
         </JournalEntryCreateRequest>
      </sfin:JournalEntryBulkCreateRequest>
   </soapenv:Body>
</soapenv:Envelope>

SOAP XML Response

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header/>
   <soap-env:Body>
      <n0:JournalEntryBulkCreateConfirmation xmlns:n0="http://sap.com/xi/SAPSCORE/SFIN" xmlns:prx="urn:sap.com:proxy:XXX:/1SAI/TAS3D871C7855B59197A671:793">
         <MessageHeader>
            <UUID>2d861220-00e6-1ede-a7af-52b25ce847c4</UUID>
            <ReferenceID>MSG_2023-06-13</ReferenceID>
            <CreationDateTime>2023-12-18T07:53:52.327135Z</CreationDateTime>
            <SenderBusinessSystemID>XXX</SenderBusinessSystemID>
         </MessageHeader>
         <ConfirmationInterfaceOrignName/>
         <JournalEntryCreateConfirmation>
            <MessageHeader>
               <UUID>2d861220-00e6-1ede-a7af-52b25ce867c4</UUID>
               <ReferenceID>SUB_MSG_2023-06-13</ReferenceID>
               <CreationDateTime>2023-12-18T07:53:52.327155Z</CreationDateTime>
            </MessageHeader>
            <JournalEntryCreateConfirmation>
               <AccountingDocument>XXXXXXXXX</AccountingDocument>
               <CompanyCode>XXXX</CompanyCode>
               <FiscalYear>2023</FiscalYear>
            </JournalEntryCreateConfirmation>
            <Log>
               <MaximumLogItemSeverityCode>1</MaximumLogItemSeverityCode>
               <Item>
                  <TypeID>605(RW)</TypeID>
                  <SeverityCode>1</SeverityCode>
                  <Note>Document posted successfully: BKPFF XXXXXXXXXXXXX2023 XXXXXXXXX</Note>
                  <WebURI>http://XXXXXXXXX.corp:50000/sap/xi/docu_apperror?ID=NA&amp;OBJECT=RW605&amp;LANGUAGE=E&amp;MSGV1=BKPFF&amp;MSGV2=XXXXXXXXX08982023&amp;MSGV3=XXXXXXXXX</WebURI>
               </Item>
            </Log>
         </JournalEntryCreateConfirmation>
         <Log/>
      </n0:JournalEntryBulkCreateConfirmation>
   </soap-env:Body>
</soap-env:Envelope>

SOAP UI

Down Payment with Taxes

Final Thoughts

Creation of Supplier Down Payments ( or Customer Down Payments) from a External System / API is not difficult through the Journal Entry API. The trick is to know that

  • There are no ITEMS needed
  • Creditor Item should have the CashDiscountTerms and DownPayment Terms populated.
  • BusinessTransactionType has to be AZAF