cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PO - File name selection SFTP connection

Former Member
0 Kudos
895

Hi All

I am currently having an issue while configuring a Communication Channel in PO.

The connection is to an SFTP server which will contain files posted every 2 hours, the file format will XX_XXXXXXXXX.xml so an example would be DR_201612111.xml (every file will be unique. 

However, in the file section I cannot seem to use a place holder as PO does not recognise the file - for example DR_*, *DR_, *.xml etc. The only way I can get this to work is by specifying a particular file which will not work.

Does anyone know how I can solve this?

My system version is: PO 7.4

Many Thanks

Phil

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Phil,

You can use below regex. This will cater only numbers after underscore and exactly 9 digits.


DR_[0-9]{9}\.xml$

Regards,

Praveen.

Ryan-Crosby
Active Contributor
0 Kudos

Yes, I forgot to add the backslash for the escape character on the second . character since it is a wildcard.

Regards,

Ryan Crosby

former_member186851
Active Contributor
0 Kudos

The Pattern I mentioned also should work.

Answers (3)

Answers (3)

umesh_badveli
Participant
0 Kudos

Hi Phil,

You can use this pattern also DR.*\.xml

If number range is not fixed length after underscore then this formate  DR.*\.xml will work.

Regards

Umesh

Ryan-Crosby
Active Contributor
0 Kudos

Hi Phil,

The implementation doesn't work the same as the file adapter.  You have to base your pattern matching on the Java Regex - if you use DR_.*.xml it should pick up the files successfully.

Regards,

Ryan Crosby

former_member186851
Active Contributor
0 Kudos

Hello Ryan,

Thanks for the reason,I was confused why SFTP behaviour is like this.

so [ ] are also not required?

Ryan-Crosby
Active Contributor
0 Kudos

Hi Raghuraman,

Not really required in this case but they can certainly be used for more complex regular expressions.  So the breakdown of the one I mentioned would be -> DR_ (anything) .xml where the DR_ and the .xml are treated as literals and the .* means any character 0 or more times.

Regards,

Ryan Crosby

former_member182412
Active Contributor
0 Kudos

Hi Ryan,

This will not work because the below file also match.

Regards,

Praveen.

Former Member
0 Kudos

That has worked perfectly - Thanks Ryan!

former_member182412
Active Contributor
0 Kudos

Hi Phil,

That worked for your file, try to put the file with extension coma(DR_201612111,xml) then channel will pick up. And put the letters after DR_ then adapter will pickup.

Regards,

Praveen.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Phil,

Don't forget to add the \ character before the second . that Praveen has mentioned - this will tell the system to treat the second . character as the . explicitly instead of a wildcard.

Regards,

Ryan Crosby

Ryan-Crosby
Active Contributor
0 Kudos

Hi Praveen,

I'm aware of how it works but I was not trying to figure out the exact requirement as I do not know it.  I'm merely providing a basic expression of how to pick up the file by knowing how the SFTP adapter works with Java regular expressions.

Regards,

Ryan Crosby

former_member182412
Active Contributor
0 Kudos

Hi Ryan,

I explained based on the requirement as he mentioned, If you just explained about regular expressions then all good.

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Hello Phil,

SFTP has a unique naming conventions

Try like below

[DR_*,]*.*xml.