Skip to Content
Technical Articles
Author's profile photo Balamurugan Jaipraakaash

Synchronous Response in CSV format using REST adapter in SAP PO/PI

Introduction:

In this blog post I’m going to brief about, How can we achieve CSV format data in the Synchronous Response structure using REST adapter in SAP PO 7.5. Before we start, It is good to have prior knowledge on what is Message Transform Bean in SAP PI/PO which would help to understand the objective of this blog post.

The requirement that we had is, 3rd party cloud system will be making a real time call to SAP ECC by consuming the RESTful web service and in return it expects/accepts the Response data back from ECC in CSV format.

Solution:

The synchronous response is been received in SAP PO from ECC through the RFC adapter in Xml format.

The synchronous REST adapter in SAP PI/PO has limitation of sending/receiving data in standard Xml/JSON.

So in order to meet the requirement of sending CSV format data, we had to leverage the Message Transform Bean functionality by applying the required module parameters/values in the REST Channel’s Module Processor. Below are the steps we applied,

Step 1:  REST Sender Channel Configuration :

Here the data format is set to JSON and Character Set Name as “UTF- 8” typically to generate CSV data in JSON format.

Step 2:  Module Parameter Configuration in REST  Sender Channel :

Here we apply the Message Transform Bean parameters as given below,

Conclusion:

Step 3 : 

Below is how the sample Synchronous Response in CSV format looks like after MTB, 

,40S2001,,0.0,F0002,CT,20200722,4124,998.75,1000.00,,0.00,,,,
,40S2002,,0.0,F0002,CT,20200722,4124,998.75,1000.00,,0.00,,,,
,40S2003,,0.0,F0002,CT,20200722,4124,998.75,1000.00,,0.00,,,,
,40S2004,,0.0,F0002,CT,20200722,4124,998.75,1000.00,,0.00,,,,

 

Hope this helps, Happy Learning!

 

Best Regards,

Balamurugan

Integration Consultant.

Assigned tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Subin S
      Subin S

      Hi bala,

      That was a nice blog. In my case, we have a requirement where we have to transmit CSV file from AL11 to microsoft azure storage. Can you guide me on that, how to achieve this using REST receiver adapter.

      I think we have to send the file as an attachment which SAP provided as a new feature in 7.5. let me know your thoughts.

      Author's profile photo Balamurugan J
      Balamurugan J
      Blog Post Author

      Hi Subin,

      Thank you!

      1. I believe you are using FTP (NFS) as Sender adapter which is gonna pick file from AL11 and sends it to azure.
      2. In your case I presume its asynchronous( correct me if itsn’t), so using REST adapter you can stillpost the file to azure but it should be received to REST in .xml format and not in .csv
      3. So you can still use the MTB’s given in the blog to achieve .csv and process to azure.

      Hope this helps!

      BR,

      Bala

      LinkedIn

      Author's profile photo Rashmi Joshi
      Rashmi Joshi

      Hi Balamurugan J ,

       

      Thanks for the blog, is it possible to receive data in CSV format by sender REST adapter transform it to XML and then post it to target system for e.g. ECC.

       

      Regards,

      Rashmi

      Author's profile photo Balamurugan J
      Balamurugan J
      Blog Post Author

      Hi Rashmi Joshi ,

      The answer is NO & the reason is CSV isn't data format its a file format. REST adapter can pick either JSON or XML data as an input. Also, we use module beans mostly for the conversion required for the target system & not for the source.

      Best Regards,

      Balamurugan

      SAP CPI & PO/PI Consultant

      Author's profile photo Sindhuja Jayapandiyan
      Sindhuja Jayapandiyan

       

      Hi Balamurugan J ,

       

      Thanks for the detailed blog!!

      We have the below requirement:

      Synchronous flow: Json request-->Rest sender adapter--> SAP PO--> ECC proxy.

      We need to send the proxy response from ECC to the sender system as an attachment through Rest sender adapter(Json Payload).

       

      Kindly guide us in sending the response as attachment to the source system.

       

      Regards,

      Sindhuja.

      Author's profile photo Angel Kenel
      Angel Kenel

      You have two options on the ABAP proxy response. Either send data as base64 and udf mapping to create attachment and swap payload. Or send as binary attachment as part of soap message and swap payload. Best to handle only one attachment per call for easier management of the file name.

      Author's profile photo Minal Bakore
      Minal Bakore

      Hi Balamurugan

      Thanks for the blog.

      Can you share how the module sequence was configured for Synchronous REST sender channel? Since this requirement was for response message, was this module 'MessageTransformationBean' added after 'CallSapAdapter' in the module chain?

      We have similar requirement to use PGP in synchronous scenario.

       

      Thanks

      Minal

      Author's profile photo Balamurugan Jaipraakaash
      Balamurugan Jaipraakaash
      Blog Post Author

      Hi Minal Bakore ,

      Yes, the 'CallSapAdapter' module will come first followed by MTB.

      Best Regards,

      Balamurugan

      Integration Consultant.