Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
kvrsaicharan1152
Explorer
3,404

Introduction


This blog post describes how to post GL Account Documents from CPI and also how to test Async API from SOAP UI.

Prerequisite:



  • Object JOURNALENTRYBULKCREATIONREQUES should be activated in SOAMANGER webservice configuration.

  • SOAP UI application should be downloaded in local system.

  • To Post Journal entries to S/4 System. Technical User should be created and have sufficient authorization.


Journal Entry - POST Asynchronous


First To test Asynchronous API, Go to Tcode SOAMANAGER in S/4 System. Click on Web service configuration and later on search with Object Name i.e JOURNALENTRYBULKCREATIONREQUES


 

Go through the object and Open service WSDL generation and save WSDL file in system with .wsdl extension.

Post JE From SOAP UI:


Now Open SOAP UI and create New SOAP Project by providing the WSDL file and now you will find two URL's  of having soap envelope versions SOAP 1.1 and SOAP 1.2

Here when you are trying to post journal entries through SOAP UI or Postman, you should provide Message ID in query parameters ex: 988C6E5C-2CC1-11CA-A044-08002B1BC518.

Now provide Technical User name and Password in SOAP UI and provide valid data in request body and then execute. For Asynchronous you will receive 202 Accepted as status code. I observed that sometimes even for bad data you will get 202 Accepted. So to check errors go to srt_log Tcode and if you want to know whether it is delivered or not you can check in srt_moni Tcode by providing the message ID that you have given while calling.

Journal Entries are posted in ACDOCA and BSEG Tables.

To check Document is created or not. Go to  Tcode SE16 -> ACDOCA/BSEG Table and Search by providing cost center ,year and currency Code

Structure of Request Payload:


<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header/>
<soapenv:Body>
<sfin:JournalEntryBulkCreateRequest xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
<MessageHeader>
<ID>MSG_2023-02-08</ID>
<!--<ReferenceID></ReferenceID>-->
<CreationDateTime>2023-02-08T00:00:00Z</CreationDateTime>
</MessageHeader>
<!--1 or more repetitions:-->
<JournalEntryCreateRequest>
<MessageHeader>
<ID>SUB_MSG_2023-02-08</ID>
<!--<ReferenceID></ReferenceID>-->
<CreationDateTime>2023-02-08T00:00:00Z</CreationDateTime>
</MessageHeader>
<JournalEntry>
<OriginalReferenceDocumentType>BKPFF</OriginalReferenceDocumentType>
<OriginalReferenceDocument/>
<OriginalReferenceDocumentLogicalSystem/>
<BusinessTransactionType>RFBU</BusinessTransactionType>
<AccountingDocumentType>   </AccountingDocumentType>
<DocumentHeaderText>Test JE Posting</DocumentHeaderText>
<CreatedByUser>     </CreatedByUser>
<CompanyCode>     </CompanyCode>
<DocumentDate>2023-02-08</DocumentDate>
<PostingDate>2023-02-08</PostingDate>
<Item>
<!--Optional:-->
<GLAccount>    </GLAccount>
<AmountInTransactionCurrency currencyCode="">1000</AmountInTransactionCurrency>
<DebitCreditCode>S</DebitCreditCode>
<DocumentItemText>Testing 0442</DocumentItemText>
<AccountAssignment>
<!--Optional:-->
<CostCenter>    </CostCenter>
</AccountAssignment>
</Item>
<Item>
<!--Optional:-->
<GLAccount>   </GLAccount>
<AmountInTransactionCurrency currencyCode="">-1000</AmountInTransactionCurrency>
<DebitCreditCode>H</DebitCreditCode>
<DocumentItemText>Testing 0442</DocumentItemText>
<AccountAssignment>
<CostCenter></CostCenter>
</AccountAssignment>
</Item>
</JournalEntry>
</JournalEntryCreateRequest>
</sfin:JournalEntryBulkCreateRequest>
</soapenv:Body>
</soapenv:Envelope>

Note:

Debit and Credit Line Items should always be balanced. If Debit Line Item Amount is 100 then Credit Line Item Amount Should be -100.

You have to provide valid cost center , GL Account and Document Type to post journal entries in s/4 system

Post Journal Entries From CPI:


To Post Journal Entries from CPI, We have to use SOAP RM Receiver Adapter. Store Technical User Name and Password in Security Store and Provide that Credential Name, URL, Location ID in SOAP RM Adapter Configuration. In Soap RM Message ID determination, you can select Generate or Reuse.

While Posting, You have to Use XSLT Mapping to provide prefix sfin: and xmlns namespace i.e xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN". You have to use after Message Mapping.


Below XSLT Code will add Prefix sfin: and xmlns Namespace to the Request Payload. SOAP RM adapter will add soap envelope automatically.

XSLT Code:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sfin="http://sap.com/xi/SAPSCORE/SFIN">
<xsl:output omit-xml-declaration="yes" indent="yes"/>

<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

<xsl:template match="JournalEntryBulkCreateRequest">
<xsl:element name="sfin:{name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

 

Conclusion


This is how we can post journal entries using Asynchronous API from CPI and SOAP UI Application

Follow my profile to be notified for the next blog post. Please feel free to ask any questions you have in the comments section below.

Hope you liked blog 🙂

 

 
3 Comments
tusharpoddar_sap
Explorer
0 Kudos
Thanks for the blog.

Can you also help understand the benefits from the end user perspective. What are the business scenarios would be possible now with these features ?
Emerson_Tosin
Explorer
0 Kudos
Hi kvrsaicharan1152

Nice blog and thank you for sharing!

I'm currently trying to perform the POST via CPI, both for the synchronous and asynchronous service as described in the Blog. Via SOAP UI there is no secret, just create/activate the service in S/4HANA via SOAMANAGER and send the messages. But via CPI, there are some complications, such as the Message Mapping and then the WSDL that we download from S/4HANA, which comes with the Policies, but SAP itself does not accept it. We have to remove it manually. Well, now I have the problem below, do you have any ideas?


That is the message in the SOAP Adapter:


Thank you

pavani
Discoverer
0 Kudos

Thank you for the Info saicharan👍

Labels in this area