cancel
Showing results for 
Search instead for 
Did you mean: 

REST adapter to RFC scenario with file exchange - SAP PI

Former Member
0 Kudos

Hello everyone!

I am working on an Interface between SAP and web Portal where the communication between SAP PI and the web will be via JSON using a REST adapter.

Communication between PI and SAP wil be via RFC adapter:

WEB(REST)-->PI-->SAP(RFC)

and the return from the interface SAP(RFC Return)-->PI-->WEB(REST) should be a file to be downloaded by portal automatically.

I considered returning a string in base 64/binary with the file contents, but that isn´t a possibility since we need the actual file to be sent for automatic download once it reaches the legacy system as per client requirements.

Has anyone tried this and can help, or perhaps comment on the feasibility of the scenarion itself?

Thank you very much.

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Fabio,

For the response message, you can put the file contents inside a base64 field and then use a UDF to extract and create the file attachment.  Then after the call adapter step in the sender REST adapter module configuration, you can use a payloadSwapBean to swap the file and the RFC response.

PS: I do not have a REST adapter to test the PoC, but your scenario is interesting.

Regards,

Mark

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

So please correct me if I am wrong.

This is your interface you want to create. I'm also assuming this is synchronous.(Because you said on the return)

1. Web(Rest) - PI -SAP(RFC) Sync | Sync SAP(RFC) - PI - WEB(File)

Also what do you mean automatic download?

You have a few options but they arent really standard but can be done. Now the question will be if you want to really use these options, because this will complicate support etc.

First option - If you want to right out a file to a specific directory this can be done in your Response mapping. This step(Sync SAP(RFC) - PI - WEB(File)). You can search on the net on how to write out a file using a UDF in SAP PI. You should get a few good blogs.

Second Option - You can do a async/sync bridge in SAP PI. All this does is. Calls a async interface and then changes it to sync at the end and then call a new interface that goes from Sync/Async. This will make it possible for you to write out a file using an interface instead of a UDF. But you will have to use a few standard adapter modules. Below are the beans.

AF_Modules/RequestResponseBean

AF_Modules/ResponseOnewayBean

This is what i understood from your question you had. Hope it helped.

Regards,

Jannus Botha