cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI ftp FIle transfer one to one with the same filename

Former Member
0 Kudos

Hello all,

maybe sombody ask the same in this forum, but couldn't find any topic regarding these.

Okay:

We have a scenario which have to pick up a txt file from a folder and to deliver to another folder

outside. The file transfer itselfs isn't a problem and works propertly, but we need the same file-

name for the outgoing file. Unfortunaltey we have huge different filenames..

So, my question would be, what for possiblities we have to sure, that if we can deliver the

file which the same filename as we have in the orginal (source) filefolder.

e.g. file named in source called TEST.123 in the destination should be also TEST.123.

The next file called TEST123.abc should be also in the destination TEST123.abc.

Thanks

Accepted Solutions (0)

Answers (7)

Answers (7)

iaki_vila
Active Contributor
0 Kudos
0 Kudos

Hi friends.

I don't know about if you need still any help. But i think it will be useful for another people who have encountered that problem and looking for the solution.

The solution is pretty simple for case if you are going to some file by scenario FTP - to - FTP without interface mapping. I was able to create simple example ant put it on my site to let you use the portable short instruction with screen shots and highlighted marks that help you understand it more clear. Indeed you don't need any udf if you wish to repeat that example in your real scenario. Link is HERE

Shortly you have to do the next:

1) for the sender adapter in tab "Advanced" switch on the check-box "Set Adapter Specific Attributes" and check that "File name" is switched on as well.

2) for the receiver adapter you have to repeat step 1 as well. Plus you have to change setting on the tab "Processing". On that tab you need to change "File Construction Mode" into "Create" and than you have to switch on the check box named as "Overwrite Existing File".

That's it.

Thank you, i hope that is help.

Sincerely, LukCAD.

0 Kudos

Thanks LukCAD

anupam_ghosh2
Active Contributor
0 Kudos

Hi Stephen,

                     I think you do not need a UDF here. You need to ensure 

1. Sender Comm Channel has ASMA  and  file name ticked.

2.Receiver Comm Channel has ASMA , file name and "fail if ASMA missing" ticked.

This should resolve your problem.

Regards

Anupam

Former Member
0 Kudos

Dear Stephan

Use this udf:

public String getFileName(Container container) throws StreamTransformationException{

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

//For getting filename

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

// Retrieve the filename

String FileName = conf.get(key);

return FileName;}

In the Sender File Adapter choose Set Adapter Specific Message Attributes and also choose FileName

Regards

Monika

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Write a UDF in the mapping area. Use Dynamic configuration to find out the file name and same can be used for the output file name too. This is the simplest solution

Former Member
0 Kudos

Hello Stephan,

You can achieve the same using Adapter specific message attribute(ASMA) in Sender and receiver file adapter and writing a small UDF for dynamic configuration. Please follow the below steps:

  • In the advanced tab of sender and receiver file adapter check 1> Use adapter specific message attribute  2> Filename.
  • In message mapping create an UDF and refer the below image.

Hope this helps.

Thanks & Regards,

Sam

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

There is a blog by Michal regarding this topic, but I am unable to find the blog (for now). What Michal did was to create a file sender/receiver cc and in those two, he enabled ASMA and then checked filename. This was done without any repository objects.

Hope this helps,

Mark

Former Member
0 Kudos

You can use dynamic file naming.

http://www.saptechnical.com/Tips/XI/ASMA/Index.htm

hope this helps.