XI: The same filename from a sender to a receiver file adapter – SP14
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:
Step 1
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.
Step 2
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.
Step 3
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 π






thx π
the solution is great and simple
which is what I like most π
Regards,
michal
why dont you answer for the queries which other users facing issues with your blog?
I always see you just replying only to those who thank to you but not to whom who got some problems while implementing your blog.
It would be great if you can .....
did you read my comment below all of my blogs - - "if you have futher..." ?
there is a place where all those questions
can be answers in less then 5 min as they are in 99% that simple - but blog comments is not that place π
hope you know why I don't answer them here now π
nothing wrong with me I just want to learn people
to post questions in a correct place
Regards,
Michal
Hello Michal!
I tried your solution here in 2014 π But, it always fails with this error; we are on SAP PI 7.40!
Mapping "http://ewe.at/best_foeger/OM_FILE_TO_MAIL_FOEGER" konnte nicht ausgeführt werden: MappingException: Runtime Exception when executing application mapping program com/sap/xi/tf/_MM_FILE_TO_MAIL_FOEGER_; Details: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Content is not allowed in prolog.
Do you have any idea, what could be wrong? My scenario is File Sender -> PI -> Mail Receiver, without any mapping. I just want to bring a .pdf to e-mail, and this with the original filename!
BR, EF
Hi Michael,
Basically my requirement to get Filename in idoc segments in order to validate the posting at month end.
Its an File to idoc scenario- GL Posting.
Please check attached UDF and it gives error. Kindly help. Thanks
Thanks for the blog. I was hoping to have this functionality almost a year ago.
Keep them coming.
Shravan
So your (our) prayers reached the SAP π
Let's hope for some more ql functionalities π
Regards,
michal
Hi Michael,
Basically my requirement to get Filename in idoc segments in order to validate the postings at month end.
Its an File to idoc scenario- GL Posting.
Please check attached UDF and it gives error. Kindly help. Thanks
The message is send by File Sender Adapter and received by File Receiver Adapter. Message type is created as a simply type hexBinary. The file is supposed to be picked up as a PDF and received as a PDF, retaining the same file name. As such, the file name is neither stored in the source structure nor the target structure.
Once the PDF file is transfered into target directory, it should be able to be open by using Acrobat directly without further conversion.
We might add a file name file into the target structure but would that rendered the PDF non-readable upon being received by the File Receiver Adapter?
Any idea is highly appreciated.
We can use file with attachhments option.Check the blog posted by sudhir porumilla.You can execute a OS command in the reciever adapter for making it non readable.
Hi Mike,Any clues ?
Hi Mike,Any clues ?
Can you please elaborate on step 3. I want to get the Filename into my Payload so that it can be modified. where exactly should I run the Java code u posted? ...
am a newbie so pls explain it in layman term pls
Thx
Arvind
Your solution perfect in XI3.0. But I couldnt get it run in PI7.0. Is there any interface or coding differences?
As long as you SP 14 or higher.
Also, do not test the code in your message mapping , this will work only during run time
Regards
Bhavesh
I have the following scenario :
I have a file sender adapter sending a hex:binary file to a file receiver.
There is another receiver which is a Web Service(SOAP) which needs the name of the file.
Is this possible? If yes then please give any clue.
Thanks
Sumit
If possible can I know that.
Thankyou.
jeevan.karu@gmail.com
variable Substitution..
I came to know thatthere is method like giving the file name like below.
%filename%.
Can you help me....
If possible can you place the Adapter Configuration SCREEN SHOTS for Sender and Receiver ADAPTERS.
Facing problem in configuration
I have followed the same and could not see the filename element in the XML ,
I did following steps:
1) Checked : Adapter Specific Confi and Filename
Since i need the filename in the XML tag , how could i do that , now in the SXMB_moni i see in inbound displaying the content of file as flat file with no tags arounds,
strange error
srini
The filename is in the DynamicConfiguration which is part of the header of the XI message. It wonβt be part of the payload!
Just user the ASMA in both the sender and Receiver Adapter
Hi Michael,
Basically my requirement to get Filename in idoc segments in order to validate the postings at month end.
Its an File to idoc scenario- GL Posting.
Please check attached UDF and it gives error. Kindly help. Thanks