cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Journal Entry (Asynchronous) API Error while posting Customer Invoice into SAP S/4H Public Cloud

prathish_23
Participant
0 Likes
2,836

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.

Accepted Solutions (1)

Accepted Solutions (1)

OwenLiu
Product and Topic Expert
Product and Topic Expert
0 Likes

Answers (2)

Answers (2)

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

Hi prathish_reddy

The message points that you are informing multiple objects in the posting. Please review if the details contains cost center and order and remove them if what you want is to post only to a WBS.

At least the profit center message seems now to be solved.

Regards,

Javier del Peso

prathish_23
Participant
0 Likes

Dear Javier del Peso,

In the provided payload, I did not include the cost center and order; I only included the profit center and WBS element for creating a customer invoice using the Journal Entry API. However, I am still encountering the following error.

Error :

While trying to perform this process manually in SAP, I successfully created a customer invoice entry without facing any problems.

During the manual entry, whenever I mention the "WBS Element," the system automatically selects the corresponding profit center and generates a customer invoice. We have properly maintained the Profit Center for the WBS in SAP.

However, when we try to post the invoice through an API, the system fails to assign the Profit Center to the WBS Element, resulting in an error.

Payload:

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

<soapenv:Header>

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

</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>

<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 to solve this issue.

Thanks and regards,

Prathish.

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

Hi prathish_reddy

Try to inform the WBS in the profitability segment (Substructure Item-ProfitabilitySupplement) only instead of the account assignment (Substructure Item-AccountAssignment). Looks like the conflict is related to the assignment, since you are informing data in both and the processing message detects two cost objects.

Regards,

Javier del Peso

prathish_23
Participant
0 Likes

Hi 546944,

I tried informing the WBS in the profitability segment (Substructure Item-profitabilitySupplement) only and I am able to pass the payload successfully. But I am not able to see the WBS element in the SAP system.

As per my requirement, the WBS must be assigned in "Account Assignment" only.

Please help me by providing another way to solve this Issue.

Thanks & regards

Prathish.

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

Hi prathish_reddy

Not sure what you mean by not able to see the WBS, please explain.

The problem is that you cannot inform both the Account assignment and the profitability segment. So if your requirement is to have the WBS as account assignment, then delete all the entries you are informing in the Substructure Item-profitabilitySupplement.

When informing both you have the message of several objects informed.

Regards,

Javier del Peso

prathish_23
Participant
0 Likes

Hi 546944,

I really appreciate your help and prompt response. And I am really apologize for the confusion.

My requirement was to create a Customer Invoice in SAP from an external source having the below details like

Expected Output in SAP :

The above-mentioned screenshots were created from a Manual Entry. In cases where the assigned WBS element is automatically linked to the Profit Center, Segment, Functional Area, and Controlling Area, these fields will be assigned automatically.

After receiving your answer stating that these fields are only derived automatically when documents are created from SAP, but not when submitted externally, I realized that the system cannot assign the Profit Center and other fields automatically when submitted externally.

Therefore, I manually mentioned the Profit Center, Segment, WBS Element, and Functional Area in the payload and submitted it. However, despite including all the fields in the Account Assignment, I am unable to see these fields in SAP.

Output when I submitted the customer Invoice Externally:

Please help me understand how I should mention the fields in the payload so that I can view the fields in SAP.

Thanks and regards,

Prathish.

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

Hi prathish_reddy

To keep supporting you on this topic it will be required to have access to your system and see what you are exactly doing.

This spans the purpose of the community and enters into consulting and support. Please contact your SAP account manager to try to solve your doubts via services. Otherwise, if you think this is a product issue, open an incident.

Regards,

Javier del Peso

prathish_23
Participant
0 Likes

Thank you.

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.