cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply input file name to output file in file adapter

Former Member
0 Kudos

Hi Friends

In my file to file scenario,i want to use input file name to output file by using adapter specific attributes,for this i have java code.Please suggest me how can i use this java code in mesg mapping and to which field i need to mapping this.

Thanks

pullarao

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

If you want to use the source file name itself as the target filename, no need for coding.

In the sender and receiver file adapter --> Select Adapter Specific Attributes --> FileName.

Give some dummy name for the filename in the receiver file adapter and in the runtime the source filename will be used as the target filename.

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Thanks for quick reply and also for easy solution.I got input file name for outfile without coding.

Thanks

pullarao

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Pullarao,

I have two questions ...

1. Are u want the static file name in the target file?

if yes...then follow the Bhavesh instruction.

2.If u want a dynamic file name in the target file using UDF....then your UDF should mapped to the <b>root element</b> of target structure.

/**********UDF********/

Imports: com.sap.aii.mapping.api.*;

Parameter: String filename

String filename;

filename = fileName + ".DAT";

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

conf.put(key, filename);

return filename;

/*******END UDF*******/

Former Member
0 Kudos

Hi,

This requirement was exactly explained here by Michal

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

Regards

Chilla

bhavesh_kantilal
Active Contributor
0 Kudos

Chilla,

What is the difference between your reply and Shabrish's reply which was posted more than a hour back?

Regards

Bhavesh

Former Member
0 Kudos

HI Sekhar,

In Michal link,i need some clarification in mesg mapping,to which field i need to map this UDF code.

Thanks

pullarao

henrique_pinto
Active Contributor
0 Kudos

You dont need UDF for your scenario.

Michal was only showing an example if u wanted to get the filename in a field of target XML.

Regards,

Henrique.

Former Member
0 Kudos

HI,

Just map the UDF from left side root node to target side root node in message mapping.

Regards

Chilla

Shabarish_Nair
Active Contributor
0 Kudos

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