cancel
Showing results for 
Search instead for 
Did you mean: 

source file name

Former Member
0 Kudos

Hi All,

I have to move source file name into one of the fields in source structure.this is FILE-FILE scenario , where source file is coming from FTP .

How to get the source file name in one of the fields in source structure?

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

justin_santhanam
Active Contributor
0 Kudos

Hem chand,

Please follow thebelow logic,which I've given in the other thread,

UDF1 -http://www.flickr.com/photo_zoom.gne?id=2180181503&size=o

UDF2- http://www.flickr.com/photo_zoom.gne?id=2180181569&size=o

Mapping -http://www.flickr.com/photo_zoom.gne?id=2180181573&size=o

Results -http://www.flickr.com/photo_zoom.gne?id=2180181575&size=o

Just modify the above as per ur reqmts.

raj.

Jitendra_Jeswan
Contributor
0 Kudos

Once the Message is arrived in XI, then only you can get the Source File Name, so it is not possible to embedd your Source file name in the Source Structure.

Options :

1) Either use the provided UDF code to get the Source file name dirctly and use in the Target strcuture(if used in target structre)

2) Or Create a Intermediate Mapping which will be used in Intergface Mapping like below:

MM1 : Source Sttructure -


> Intermediate Structure (with File Name field)

MM2: Intermediate Structure (with File Name field) -


> Target Structure

In Interface Mapping: Use these 2 Message Mappings.

Hope this helps:-)

Regards.

Jeet.

Former Member
0 Kudos

Hi Jeet,

I think option 2 will work in my case.

if i take Intermediate Structure (with File Name field) , whats the procedure to get the file name into that field.

Reg,

Hem

Former Member
0 Kudos

Hi,

If ur taking the intermediate structure then the intermediate will become target for first mapping and in next mapping the intermediate will become the sender.

source - intermediate

intermediate - target

Inthis case check the UDF which i have provided for you,use that UDF u will get the file name in intermediate payload and fron that i will go to target side.

Regards,

Phani

Reward points if Helpful

Former Member
0 Kudos

Hi,

Were u need to get the file name at source side or target side.

If u need to get the file name at target side write this UDF and map it to target field.

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;

Regards,

Phani

Reward points if Helpful

Former Member
0 Kudos

Hi ,

I need to get the source file name at source side.

thanks.

aashish_sinha
Active Contributor
0 Kudos

Hi,

I think, you want to provide a name for you Source File/FTP adapter file name. you can give anything and at the FTP side your file name shud match the name provided by you at the time of file/ftp sender CC configuration.

Hope this wil;l clarify you. Above code was dynamic file name generation (Target side).

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Hi,

The explanation given by Aashish Sinha will work if in case you have the constant file name at all time.

But there may be possibility to get the file name at runtime. (May be timestamp or counter is used)

The sender file name will successfully get with below code.

Use the below code in UDf to get the file name from sender,

try {

obj = inputModuleData.getPrincipalData();

msg = (Message) obj;

// Get the Supplemental data which is available as hash table

Hashtable mp = (Hashtable)

inputModuleData.getSupplementalData

("module.parameters");

// Get the file name which is being processed

if (mp != null) fileName = (String) mp.get("FileName");

}

Thanks

Swarup.

Edited by: Swarup Sawant on Jan 28, 2008 9:55 AM