cancel
Showing results for 
Search instead for 
Did you mean: 

Request from backend to read file

Former Member
0 Kudos

Hello experts!

I need to trigger a sender channel to read a file via file or SFTP adapter. I cannot use BPM...

I know, I can using the external control to start and stop the channel.

But that doesn't serve my requirements because I don't know, when the data arrives in the backend then.

My plan is to send a request via RFC that creates a trigger file and waits for a resonse.

The response is created by another channel, which polls for the trigger file and reads the actual datafile then.

It almost works with the following scenario:

  • Backend sends a RFC-request to PI and waits for a reply
  • PI creates a file throuth file or SFTP adapter
  • Another file/SFTP adapter polls for a file and sends it's data back to the RFC channel

I read http://scn.sap.com/blogs/henrique/2007/08/02/syncasync-scenarios-without-bpm

and https://wiki.sdn.sap.com/wiki/display/XI/File-RFC-File%28Without+BPM%29

but those scenarios don't fit completely...

What I archieved is, that my RFC-function (I'm using STFC_CONNECTION for testing) waits for a response.

For the response, the filename (for testing reason fix HK02.txt) is used as "correlation-ID".

In the RFC-Sender I used this modules to wait for a respnse:

1AF_Modules/DynamicConfigurationBeanLocal Enterprise BeandynConfig
2AF_Modules/DynamicConfigurationBeanLocal Enterprise BeandynConfig2
3AF_Modules/RequestOnewayBeanLocal Enterprise Beanrequest
4RfcAFBeanLocal Enterprise Bean0
5AF_Modules/WaitResponseBeanLocal Enterprise BeanwaitResponse

Config:

dynConfigkey.0insert http://sap.com/xi/XI/System/File FileName
dynConfigkey.1insert http://sap.com/xi/XI/System/Messaging correlationId
dynConfigvalue.0HK02.txt
dynConfigvalue.1HK02.txt
dynConfig2key.0write http://sap.com/xi/XI/System/Messaging correlationId
dynConfig2value.0message.correlationId
requestpassThroughtrue
waitResponsetimeout60000

[PS: Maybe the correlation Config could be easier, but that's not the issue.]

In my file sender, I used this to notify the RFC:


Module
KeyComment
1AF_Modules/DynamicConfigurationBeanLocal Enterprise BeandynConfig
2AF_Modules/RequestResponseBeanLocal Enterprise Beanrequest
3CallSapAdapterLocal Enterprise Bean0When I remove this, notification works!
4AF_Modules/NotifyResponseBeanLocal Enterprise Beannotify

Config:

dynConfigkey.0write http://sap.com/xi/XI/System/File FileName
dynConfigvalue.0message.correlationId
notifytimeout60000
requestpassThroughtrue

The problem now is:

  • If I don't add the CallSapAdapter in the FileSender, PI notifies my RFC-Sender. No errors - but also no payload!
    • Then I know, that a file exists, but cannot access the contents...
  • If I add the CallSapAdapter, I also need receiver and interfacedeterminations. But just want to send the result back to the RFC.
    • And the mapping is done using the "response"-tab in the OM...
    • --> How do I connect the Response-Mapping in the Integration Builder since I cannot use a Sender-Channel as receiver for the response?

Does anyone have a good idea on this?

Some more example scenario descriptions would be nice!

Accepted Solutions (0)

Answers (1)

Answers (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

I think you can break the requirement into two scenarios.

Abap proxy to file and the second scenario is file to abap proxy. Send the trigger using abap proxy from the sap system to PI and pi creates the file in a specified folder.  Another scenario is to poll the file and pass it to server proxy. Hope this helps.

Former Member
0 Kudos

Unfortunatly, we cannot use proxies in our system.

This is because we need to connect a different PI system later and maybe connect both systems simultaneously.

Anyway, where's the difference or advantage? My problem is, that I want to send a request and get the response back immediately (as long as it takes, of course) back.

What were are trying is to simply replace a

OPEN DATASET FOR INPUT

in the backend  by

CALL FUNCTION xxx REMOTE DESTINATION <PI>.

Another solution would be to trigger the import and then wait until the data arrives in SXMB_MONI.

But I don't like that very much, because you never know how long to wait.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

File is async type adapter. If you want to get the response back immediately then you have to use ccbpm. Do you have any reason for choosing file adapter? If not then you can go with other adapters and make the scenario synchronous.  Please elaborate more about the requirement.

Former Member
0 Kudos

Yes, I know that file is assync.

But that's why I'm trying to use the Sync/Assync Bridge using the modules. It should work somehow...

Unfortunatly, we cannot change all interfaces from file to something else, because it depends on the receiver/sender of the file. We are implementing PI in a large existing system with over more than 100 interfaces. Most of them are files.