cancel
Showing results for 
Search instead for 
Did you mean: 

Getting File Name (Sender File Adapter )

Former Member
0 Kudos

Hi EveryBody,

I need to capture only the the FileName in to the outbound xml that is present in the filepath of XI server.

I checked:

Adapter Specific Message Attributes:

Checked box on --> 1)Set Adapter Specific Message Attributes

2) File Name

And my dt IS OF TYPE :

<?xml version="1.0" encoding="UTF-8"?>

<MT_DMS_FINAL>

<Header>

<FileName/>

</Header>

</MT_DMS_FINAL>

Now i put the File into the path , i donot need any content of file in XML , only needed the file name.

i tried above config and it says mapping error, but i test it"s running good with the test tab.

i guess file picked up by Sender file Adapter is not matching witj the outbound interface ?? is it so ?

advice. i see in the sxmb_moni that only the content not in xml structure is displayed.

srini

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member194786
Active Contributor
0 Kudos

Hi,

To get the file name in a field of ur target u need a UDF. Refer the following blog. Use the UDF provided in the blog and map it to the target field(whichever u wish to) in the message mapping. This will solve the problem.

Hope it helps.

Regards,

Sanjeev.

Edited by: Sanjeev Shekhar Singh on May 30, 2008 1:15 PM

Former Member
0 Kudos

Hi,

U have to use variable substitution to get the fie name by mapping it to a target field and also use dynamic configuration for that

pls heck this blog by

/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi

Reward points if u found it useful

Former Member
0 Kudos

Well this is used when we want the Receiver Adapter to have the same file name by setting up the variable,

well here my target in terface is different and not same ,

my requirment and question is , how could i get the "FileName" element in the outbound xml document,

Since i have made a check mark on the Adapter Specific config / and FileName --> How to get it done.

With regards

Srini

former_member194786
Active Contributor
0 Kudos

Hi Venkateswarlu,

Why do you need File Name in the outbound xml anyway???

Regards,

Sanjeev.

Former Member
0 Kudos

Well when i see in Inbound of sxmb_moni transaction of PI system i donot see the file name ,

there is not xml structure in the payload diplayed , it displays as a flat file with the content of the file with no tags around.

seems to be some config prob

with regards

Srinivas

former_member194786
Active Contributor
0 Kudos

Hi Venkateswarlu,

If you have just selected the ASMA in the communication channel and you are not using the UDF, in that case you need to go to the Dynamic Configuration tab in the SXMB_MONI. There you can see the File name displayed. Hope its clearer now.

Regards,

Sanjeev.

Former Member
0 Kudos

Exactly , i can see that in "Dynamic Configuration tab " in SXMB_MONI.

Well here my Sender File Adapter picks up file of any format , then i just need to get the filename , this filename is split and mapped further to my target in terface.

That is my requirment , so i need to get that filename present in the "Dynamic Configuration tab " to be in the interface not the content of File once picked up by file.

if you say i should use the UDF , well what could be the source map ?? confused

Source Interface -


(My UDF to split Filename) -


Target Interface

Above thing would give a clear picture,, hope so

srini

former_member194786
Active Contributor
0 Kudos

Hi Venkateswarlu,

I got your prob now. The solutin can be as follows:

Lets say you have 5 files. Make different message types/interfaces for each of them. Now in the mapping you go to the messages tab. There in the Source side you provide all the message types created and there occurence as 0...1. On the target side you provide the target message type as you want. Then in the mapping you can directly create the UDF. It has no input parameters. So you map directly to the target fiels, wherever required.

Hope it helps.

Regards,

Sanjeev.

Former Member
0 Kudos

Hi Sanjeev,

So in my case ,

Source Interface would be kind of Dummy right , since i donot need to map anything ,

As my requirment demands or my target interface demands only the filename input in split format.

So now i create the UDF to get the "file name" and map it to target interface.

am i clear in ?? now

srini

Former Member
0 Kudos

Hi Sanjeev,

But when we create a UDF it atleast have one input as argument "a" right ?

How to create a UDF that can be used only for target

it sounds like conatnt mapping where we give the value in it

please advice

srini

former_member194786
Active Contributor
0 Kudos

Ya exactly.

But it should have all the files embedded in the Source tab of the message mapping. Rest all you got it correct.

And ya one more thing, the output of the UDF will provide the filename. This you can split using the standard functions in the message mapping and the result you can map to the target field.

Try it and let me know.

Regards,

Sanjeev.

Reward points if it was helpful.

former_member194786
Active Contributor
0 Kudos

Refer to the blog that i asked you to go thru. It has no input fields. It accesses the file name through the Dynamic Configuration. Provides the same as output. Its just a java function without any input parameter. Create an UDF and deleted all the arguments(even "a").

Code:-

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

Oops sorry, i guess i forgot to provide the blog link. Anyway its here:

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Regadrs,

Sanjeev.

Edited by: Sanjeev Shekhar Singh on May 30, 2008 2:12 PM

Former Member
0 Kudos

i have created a UDF as said , i tested it it said runtime error , i undertand myself as it is runtime component it should be captured runtime only

but i donno y i still get the mapping error ??

wondering how to design my

interface outbound

srini