cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Dear Experts,

I am attempting to create a Customer Invoice in SAP S/4HANA Public Cloud using the Journal Entry Asynchronous API. During the process, I encountered the following error:;

According to the error description, I already assigned the profit center to the WBS element.

I manually created a Customer Invoice with WBS without a Profit center and it is automatically taking the Profit center according to the WBS element but when I try to post the below payload using the API with the WBS element I was facing the above error.

Payload:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN"> <soapenv:Header> <messageId xmlns="http://www.sap.com/webas/640/soap/features/messageId/">urn:uuid:{{$guid}}</messageId> </soapenv:Header> <soapenv:Body> <sfin:JournalEntryBulkCreateRequest> <MessageHeader> <ID>MSG_2023-06-04</ID> <CreationDateTime>2023-06-04T00:00:00Z</CreationDateTime> </MessageHeader> <JournalEntryCreateRequest> <MessageHeader> <ID>MSG_2023-06-04</ID> <CreationDateTime>2023-06-04T00:00:00Z</CreationDateTime> </MessageHeader> <JournalEntry> <OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType> <BusinessTransactionType>RFBU</BusinessTransactionType> <AccountingDocumentType>DR</AccountingDocumentType> <DocumentHeaderText>Test Customer Inv Posting</DocumentHeaderText> <CreatedByUser>9980000017</CreatedByUser> <CompanyCode>10</CompanyCode> <DocumentDate>2023-06-04</DocumentDate> <PostingDate>2023-06-04</PostingDate> <TaxDeterminationDate>2023-06-04</TaxDeterminationDate> <Item> <ReferenceDocumentItem>1</ReferenceDocumentItem> <CompanyCode>10</CompanyCode> <GLAccount>41000000</GLAccount> <AmountInTransactionCurrency currencyCode="AED">-1600</AmountInTransactionCurrency> <DebitCreditCode>H</DebitCreditCode> <DocumentItemText>Test Item</DocumentItemText> <Tax> <TaxCode>S4</TaxCode> </Tax> <BusinessPlace>ABC</BusinessPlace> <AccountAssignment> <WBSElement>DM1</WBSElement> </AccountAssignment> <ProfitabilitySupplement> <Customer>2000021</Customer> </ProfitabilitySupplement> </Item> <DebtorItem> <ReferenceDocumentItem>2</ReferenceDocumentItem> <Debtor>2000005</Debtor> <AmountInTransactionCurrency currencyCode="AED">2000</AmountInTransactionCurrency> <DebitCreditCode>S</DebitCreditCode> <DocumentItemText>Testing Debitor Item</DocumentItemText> </DebtorItem> <ProductTaxItem> <TaxCode>S4</TaxCode> <TaxItemClassification>MWS</TaxItemClassification> <AmountInTransactionCurrency currencyCode="AED">-400</AmountInTransactionCurrency> <DebitCreditCode>H</DebitCreditCode> <TaxBaseAmountInTransCrcy currencyCode="AED">-1600</TaxBaseAmountInTransCrcy> </ProductTaxItem> </JournalEntry> </JournalEntryCreateRequest> </sfin:JournalEntryBulkCreateRequest> </soapenv:Body></soapenv:Envelope>Please help me in solving this Issue.Thanks & regards,Prathish.

0 Likes
View Entire Topic
Javier_del-Peso
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi prathish_reddy

When posting via API, please inform the Profit center in the payload. The item you are posting has Substructure Item-Account Assignment (for the Profitability Supplement) and it's there where the Profit Center needs to be populated.

It's only derived automatically when documents are created from SAP, but not when externally. Check out this help.

Journal Entry - Post (Asynchronous) | SAP Help Portal

Item | SAP Help Portal

Regards,

Javier del Peso

prathish_23
Participant
0 Likes

Hi 546944,

Thank you for your prompt response.

I tried posting the Profit Center as you mentioned along with the WBS element but I am facing the below error:

Error:

Payload:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">

<soapenv:Header>

<messageId xmlns="http://www.sap.com/webas/640/soap/features/messageId/">urn:uuid:{{$guid}}</messageId>

</soapenv:Header>

<soapenv:Body>

<sfin:JournalEntryBulkCreateRequest>

<MessageHeader>

<ID>MSG_2023-06-04</ID>

<CreationDateTime>2023-06-04T00:00:00Z</CreationDateTime>

</MessageHeader>

<JournalEntryCreateRequest>

<MessageHeader>

<ID>MSG_2023-06-04</ID>

<CreationDateTime>2023-06-04T00:00:00Z</CreationDateTime>

</MessageHeader>

<JournalEntry>

<OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>

<BusinessTransactionType>RFBU</BusinessTransactionType>

<AccountingDocumentType>DR</AccountingDocumentType>

<DocumentHeaderText>Test Customer Inv Posting</DocumentHeaderText>

<CreatedByUser>9980000017</CreatedByUser>

<CompanyCode>10</CompanyCode>

<DocumentDate>2023-06-04</DocumentDate>

<PostingDate>2023-06-04</PostingDate>

<TaxDeterminationDate>2023-06-04</TaxDeterminationDate>

<Item>

<ReferenceDocumentItem>1</ReferenceDocumentItem>

<CompanyCode>10</CompanyCode>

<GLAccount>41000000</GLAccount>

<AmountInTransactionCurrency currencyCode="AED">-1600</AmountInTransactionCurrency>

<DebitCreditCode>H</DebitCreditCode>

<DocumentItemText>Test Item</DocumentItemText>

<Tax>

<TaxCode>S4</TaxCode>

</Tax>

<BusinessPlace>ABC</BusinessPlace>

<AccountAssignment>

<ProfitCenter>101</ProfitCenter>

<Segment>1000_C</Segment>

<WBSElement>DM1</WBSElement>

</AccountAssignment>

<ProfitabilitySupplement>

<Customer>2000021</Customer>

</ProfitabilitySupplement>

</Item>

<DebtorItem>

<ReferenceDocumentItem>2</ReferenceDocumentItem>

<Debtor>2000005</Debtor>

<AmountInTransactionCurrency currencyCode="AED">2000</AmountInTransactionCurrency>

<DebitCreditCode>S</DebitCreditCode>

<DocumentItemText>Testing Debitor Item</DocumentItemText>

</DebtorItem>

<ProductTaxItem>

<TaxCode>S4</TaxCode>

<TaxItemClassification>MWS</TaxItemClassification>

<AmountInTransactionCurrency currencyCode="AED">-400</AmountInTransactionCurrency>

<DebitCreditCode>H</DebitCreditCode>

<TaxBaseAmountInTransCrcy currencyCode="AED">-1600</TaxBaseAmountInTransCrcy>

</ProductTaxItem>

</JournalEntry>

</JournalEntryCreateRequest>

</sfin:JournalEntryBulkCreateRequest>

</soapenv:Body>

</soapenv:Envelope>

If I send only the profit center without a WBS element, I am able to create a customer invoice without WBS element assignment at SAP System level. However, my requirement is to create a customer invoice with a WBS element.

If there is any way I can provide the WBS element in the payload and replicate the same thing in my SAP system, please help me.

Thanks & regards,

Prathish.