cancel
Showing results for 
Search instead for 
Did you mean: 

SFTP receiver channel Archive filename isssue

Former Member
0 Kudos

Hi,

I am working on SAP SFTP adapter (SAP PI7.4).

SFTP receiver channel is placing the file with correct filename as generated by dynamic configuration code but sftp channel is adding an extra .txt extension in filename while archiving.

Example:       Actual Filename: CCBGI.SSEN_TNG.BATCH0000000000000052.sft

                    At archive folder : CCBGI.SSEN_TNG.BATCH0000000000000052.sft.txt

 

 

Please suggest resolution for this.

Thanks & Regards,

Nida Fatima

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Nida,

You can change the file name in SFTP using the ASMA configuration, in this way you would need ESR development.

To use ASMA configuration, check these links:

SAPTechnical.COM - Dynamic File name using ASMA (Adapter Specific Message Attributes) in XI / PI

Dynamic file name and directory in Receiver File Adapter - summary of possibilities - Process Integr...

Another solution is to use OS command.

Regards.

Former Member
0 Kudos

Hi Inaki,

We are already using Dynamic configuration in ESR using ASMA configuration.

Channel is placing file with correct name at SFTP server but adding extra .txt extension in archived filename.

Thanks & Regards,

Nida Fatima

iaki_vila
Active Contributor
0 Kudos

Hi Nida,

In the UDF code you can set the name of the file that you want. Could you share your java code?, or try to use the code in the first link that i share:

filename = filename.replaceAll( ".sft" ,".txt" );

Regards.

Former Member
0 Kudos

Hi Nida,

Please also see the link below.

Regards,

Jannus BOtha

Former Member
0 Kudos

Hi Jannus,

I tried your %TS option but issue is still not resolved.

Its adding timpestamp at the start of the filename but no change in file extention.

Thanks & Regards,

Nida Fatima

Former Member
0 Kudos

Hi Nida

You have mentioned that you are generating the file name in mapping and use dynamic configuration.

But the receiver channel screen shot if you have provided, does not have the ASMA attribute checked.

Please check the ASMA like below

Former Member
0 Kudos

Hi Indrajit,

My UDFdynamic filename is working fine.We are placing the correct filename at sftp server.

Issue is with archive filename.

Former Member
0 Kudos

There is an SAP-note 1817747 on this which tells you: "It's not a bug, it's a feature".

http://service.sap.com/sap/support/notes/1817747


Symptom

At the sender side of SFTP Adapter, the flag "Archive Files on PI Server" is checked and the field "Archive name" is configured to archive the files on PI Server. During message processing, it is noticed, that, files are being archived in the archive directory with ".txt" extension.

Reason and Prerequisites

This feature has been added as a part of security so that the files will be saved with ".txt" extension in the archive directory. If it is allowed to be saved with original name on the PI server, then an external attack can manipulate the path where the file has been archived and gain access to OS related path and modify the files. Hence, to avoid such security issues, the file extension is always changed to ".txt".

Anyway, you might have a look at SAP-note 1815655 as there is an advanced parameter mentioned to add a "default extension" to a file. http://service.sap.com/sap/support/notes/1815655


Also, an advanced mode parameter "addDefaultFileExtension" has been introduced. If this parameter is set to 'true', then, while archiving the files on SFTP server, the additional check will be performed to check whether the file has ".txt" extension or not. If not, then the ".txt" extension will be added with the file name. Else, normal execution continues i.e. files will be archived on the SFTP server with their original name.

The default value for the parameter "addDefaultFileExtension" is 'false'.

Former Member
0 Kudos

Hi Heiko,

Thanks for your reply.

I will test it today and let you now.

Regards,

Nida

Former Member
0 Kudos

Hi Heiko,

Sorry for late reply.

Your solution worked. The channel is still placing filewith extra .txt but this time I am able to read it.

Thanks & Regards,

Nida Fatima


Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Souvik,

I can't see any option  for filetype in SFTP receiver channel. Could you please recheck and confirm with screenshot.

Regards,

Nida

Former Member
0 Kudos

Hi,

In the Processing tab make File Type as Binary.

Please find the screenshot:

This will avoid .txt format.

Hope this helps!

Regards,

Souvik

former_member203641
Participant
0 Kudos

Hi Nida,

Here is my assumption of your interface

You are using UDF in message mapping for dynamic configuration of file name.

In the receiver SFTP channel, apart from placing the file on the target SFTP server directory (where you are getting proper file name from dynamic configuration) you also wish to archive the file on the local application server for reference purpose for which you must be using standard Archiving Module and provided by SAP in Module tab of SFTP adapter to do this.

If my assumption are correct then i would suggest check and confirm if you have specified name as .txt in that. Also, if you are facing same file name issue on SFTP server directory also then i would suggest check the UDF code once if there you have put .txt extension.

If the above does not help then, please provide more details about dynamic configurations so that we can analyse.

Thanks,

Amit

Former Member
0 Kudos

Hi Amit,

For archiving we are not using any module. I have used standard archiving functionality provided in channel.

File placed at sftp server has correct filename but the file which is archived at our local server is adding additional .txt in complete filename.

So i don't think there is any issue with UDF .

Thanks & Regards,

Nida

Former Member
0 Kudos

Hi,

Have you had a look at this blog?

Regards,

Jannus Botha

Former Member
0 Kudos

Hi Jannus,

I have done below config for archive path.

Please let me know if there is anyother way to do it.

Thanks & Regards,

Nida


Former Member
0 Kudos

Hi Nida,

Can you please then add the following after ARCHIVE\. It will now be ARCHIVE\_%TS.

Please test that.

Regards,

Jannus Botha