cancel
Showing results for 
Search instead for 
Did you mean: 

File name configuration in PI 7.30

Former Member
0 Kudos

Hi All,

I have a scenario where PI picks up a file from sftp server, process it and send  it to ECC. The vendor will place two files(with different names) at different timings. I need to have same file name as it is sent by the sender.

ex: sender send a two files as "abc.txt" and another file as "def.txt". The requirement is to have same file name which PI places in the ftp folder.

In ID i configured one sftp sender channel and ftp receiver channel.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor

Hi Vijay - Enable the adapter specific message attributes in both the channel and have a look at the below thread.

Former Member
0 Kudos

I tried that but there is no luck in getting the file name.

former_member184720
Active Contributor
0 Kudos

in your sender SFTP, under adapter specific message attributes.

change the namespace to "http://sap.com/xi/XI/System/File" and file name to "FileName"

Former Member
0 Kudos

I have used the ASMA as like in the image above. Do I need to make any changes on the receiver FTP channel and should i put * in File name scheme option in the receiver channel.

former_member184720
Active Contributor
0 Kudos

you can put dummy in the receiver channel filename. No changes in the receiver channel just enable ASMA for filename

Former Member
0 Kudos

How can we set dummy in File name scheme and below is the settings did in receive channel

do i need to use any variable substitution ?

former_member184720
Active Contributor
0 Kudos

No no.. this is fine. What i meant was set the Filename option under "Target" to dummy

Former Member
0 Kudos

I have put the file name as dummy but when process a file in the target system the file name is coming as "dummy"

Former Member
0 Kudos

Hello,

Ideally enabling ASMA (and changing SFTP default namepsace) in channels should work.

BTW, did u check at runtime whether SFTP name is coming under message attributes or not?

Thanks

Amit Srivastava

former_member184720
Active Contributor
0 Kudos

seems like the adapter specific attributes are not being populated. check for the runtime constants.

just validate the configuration once again and see if you have given the namespace properly in SFTP sender channel(no extra spaces)

Former Member
0 Kudos

Hi All,

I am getting the target file name as per the input file names but the file is coming with the same timestamp (For Ex: the input file is "POD_AMA_050120010039.txt" the target file name also is same) of the input file how can i remove that as i want the file name to be POD_AMA.txt?.

In receiver channel i have configured "File Construction Mode" as Create.

Former Member
0 Kudos

Hello,

U have to use dynamic configuration UDF to remove timestamp from input file name.

Thanks

Amit Srivastava

praveen_sutra
Active Contributor
0 Kudos

hi Selva,

have u tried below settings.

And please check what is the error are you getting.

reference:

thanks and regards,

Praveen T

Former Member
0 Kudos

Hi Praveen,

I did use that option. Moreover now I can place the file in the target folder with the same file name which PI is picking but its coming with timestamp. Is there anyway without using UDF can we remove the timestamp

former_member184720
Active Contributor
0 Kudos

Hi Selva - As suggested by Amit,you can define a UDF in your mapping and remove the extra timestamp.

Former Member
0 Kudos

Can anyone provide me with the sample UDF to remove timestamp.

former_member184720
Active Contributor
0 Kudos

Hi Selva - Try the below

String filename    = "";
DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");

filename = conf1.get(key1);
filename = filename.substring(0, filename.lastIndexOf("_"))+filename.substring(filename.lastIndexOf("."));
conf1.put(key1,filename);

return filename;

map it to your target message type and no need to change anything in adapters

Former Member
0 Kudos

Hi hareesh thanks for the code and it really helped me in resolving this.

Thanks all for you valuable suggestion!

former_member184720
Active Contributor
0 Kudos

Good to know and ywc Selva

Answers (0)