Finally (from SP14) we can receive a file do something with it inside XI
and send it back with the same name. No need for writing adapter modules,
no need for variable substitution – SAP gave us a new, easy solution to this issue.
From XI 3.0 SP14 we can use Adapter Specific Message Properties.
Now not only can we use the filename of the received file but we can also change it
inside our mapping (using graphical mapping for example).
Let’s see how the scenario works:
Inside your file/FTP adapter we can now set “Adapter Specific Message Properties”
which tell the adapter to include those properties inside the SOAP message sent to XI
from the adapter. Because we want to see the whole example we can start by setting all of them.
The file/FTP receiver adapter must also know that he has to use those new properties
so we also have to set them on the receiver’s side.
Because we also want to get the filename inside our mapping we have to create a user defined function
which will return the filename and map it to one of our XML tags.
The code shown above just takes the filename so we can map it, if you’d like to change it
have a look at the code provided by SAP: Accessing Adapter-Specific Properties
When we run our file to file scenario we can now see that there’s a new section called DynamicConfiguration….
…which is being populated with some values.
When we take a look at our outbound message we can see that one of our tags has the filename value.
Later on we can check our FTP folder to find out that the created file has exacly the same name
as the file from the sender adapter.
Easy wasn’t it? This example just shows that SAP listens to us (developers)
to make our lives a little bit easier 🙂