cancel
Showing results for 
Search instead for 
Did you mean: 

Double debtor line item in journal entries API S/4HANA Cloud

DavidAvila
Explorer
0 Kudos
384

Hi,

We are using an API for S/4HANA cloud (Journal entries- POST, SOAP API). We want to know if it is possible to send in the API two debtor line items, as I show you below.

We use this API to post the payment of an invoice from the customer, but, when the customer has a down payment and we put two line items for the debtor, one with a debit code (S) and the other with the credit code (H), we get an error.

The first debtor line item makes reference to the down payment with a value of 89000

The second line item makes reference to the account balance with a value of 52176

The third debtor line item makes reference to the total of the invoice with a value of - 141176

The credits and the debits have the same amount

            <JournalEntry>
               <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
               <BusinessTransactionType>RFBU</BusinessTransactionType>
               <DocumentReferenceID>RECAUDOS</DocumentReferenceID>
               <AccountingDocumentType>ZD</AccountingDocumentType>
               <DocumentHeaderText>RECAUDO TITAN</DocumentHeaderText>
               <CreatedByUser>CB9980000013</CreatedByUser>
               <CompanyCode>4810</CompanyCode>
               <DocumentDate>2023-06-20</DocumentDate>
               <PostingDate>2023-06-20</PostingDate>
               <TaxDeterminationDate>2023-06-20</TaxDeterminationDate>   
               <DebtorItem>
                  <ReferenceDocumentItem>1</ReferenceDocumentItem>
                  <Debtor>1000965</Debtor>
                  <AmountInTransactionCurrency currencyCode="COP">89000</AmountInTransactionCurrency>
                  <DebitCreditCode>S</DebitCreditCode>
                  <DocumentItemText>Down payment</DocumentItemText>
                  <Reference1IDByBusinessPartner>-----</Reference1IDByBusinessPartner>
                  <Reference3IDByBusinessPartner>DAVID ----</Reference3IDByBusinessPartner>
                  <DownPaymentTerms>
                  <SpecialGLCode>A</SpecialGLCode>
                  <TaxCode>V0</TaxCode>
                  </DownPaymentTerms>
               </DebtorItem>
               <Item>
                  <ReferenceDocumentItem>2</ReferenceDocumentItem>
                  <GLAccount>11051050</GLAccount>
                  <AmountInTransactionCurrency currencyCode="COP">52176</AmountInTransactionCurrency>
                  <DebitCreditCode>S</DebitCreditCode>
                  <DocumentItemText>ACCOUNT BALANCE</DocumentItemText>
                  <Reference1IDByBusinessPartner>-----</Reference1IDByBusinessPartner>
                  <Reference3IDByBusinessPartner>DAVID ----</Reference3IDByBusinessPartner>
                  <AccountAssignment>
                     <ProfitCenter>4810111121</ProfitCenter>
                  </AccountAssignment>
               </Item>
               <DebtorItem>
                  <ReferenceDocumentItem>3</ReferenceDocumentItem>
                  <Debtor>1000965</Debtor>
                  <AmountInTransactionCurrency currencyCode="COP">-141176</AmountInTransactionCurrency>
                  <DebitCreditCode>H</DebitCreditCode>
                  <DocumentItemText>TOTAL INVOICE</DocumentItemText>
                  <AssignmentReference>0090000057</AssignmentReference>
                  <Reference1IDByBusinessPartner>-----</Reference1IDByBusinessPartner>
                  <Reference3IDByBusinessPartner>DAVID ----</Reference3IDByBusinessPartner>
               </DebtorItem> 
               <ProductTaxItem>
                  <TaxCode>V0</TaxCode>
                  <TaxItemClassification>VST</TaxItemClassification>
                  <AmountInTransactionCurrency currencyCode="COP">0</AmountInTransactionCurrency>
                  <DebitCreditCode>S</DebitCreditCode>
                  <TaxBaseAmountInTransCrcy currencyCode="COP">89000</TaxBaseAmountInTransCrcy>
                  <TaxBaseAmountInGroupCrcy currencyCode="COP">89000</TaxBaseAmountInGroupCrcy>
               </ProductTaxItem>                         
            </JournalEntry>
         </JournalEntryCreateRequest>
      </sfin:JournalEntryBulkCreateRequest>
   </soapenv:Body>
</soapenv:Envelope>
But, the API responds with a balance error:

Thank you in advance.

Best regards.

frederick666
Discoverer
0 Kudos

I think the problem is with the that line "The second line item makes reference to the account balance with a value of 52176". The question is that do you really need it.

Presumably, the total debt owed as represented in invoice, is already in the system in the customer account. When the customer makes down payment, this would automatically reduce the amount outstanding in the corresponding customer account and simultaneously post the balance thereof. The system is built to do the calculations in the customer account. All the system needs to do is reflect balance in customer account. The question that follows is, does one really need to separately post account balance? Your proposition some how suggests duplication of tasks. Just a thought.

frederick666
Discoverer
0 Kudos

The account balance is a function between invoice amount and down payment, which is through principles of debit and and credit is automatic. Whereas the down payment is made by the customer, this is settled at the Bank in absolute terms. Therefore, the reduction in customer outstanding amount will increase the Bank Balance, case closed.

Accepted Solutions (0)

Answers (2)

Answers (2)

Vittorio1
Explorer
0 Kudos

Just group nodes DebtorIetm together, without any other items in between.

Hint was given by Yang from SAP - cudos to him!

Vittorio1
Explorer
0 Kudos

I have the same question