cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Substitution for Source Directory

Former Member
0 Kudos

Hello,

I have seen several threads about using a UDF and variable substitution for dynamically determining the Target Directory.

Is anyone familiar with (or had to implement) a solution where the Source Directory is dynamically determined.

My challenge is to connect to a different Source Directory name (sy-datum format, ex: 20070920 ) each day on an ftp site and download all the files in the folder to a know target directory. I am doing a simple file-to-file transfer, so no mapping is involved.

Your comments, suggestions and feedback is greatly welcomed.

Thanks,

Ralph

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ralph,

Check out this thread..

the response from satyanarayan...

Hope this will help.

Nilesh

Former Member
0 Kudos

Nilesh,

Thank you for that link. I had previously viewed that one as well.

My FTP Sender comm channel looks like:

Source Directory: /%directoryname%/

At the bottom, under Advanced Mode, I have:

Variable: directoryname

Parameter: systemdate

I have even attempted using Parameter: 20070920

which is an actual folder name, but I see it fails in the adapter monitor, unable to change directory.

I was hoping to avoid extensive java coding for something as simple as this.

No mapping is used, which would not help any way since I an trying to determine the Source Directory and not the Target.

Thanks once again.

Ralph

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ralph,

I have the same problem.

Did you find a good solution?

Thanks,

Carme

Former Member
0 Kudos

Hello Carme,

I have not found a solution for this type of event.

I was attempting this because the FTP site I was connecting to would DELETE a file the moment XI touched it. So when XI (using FTP Transfer protocol) configured with a DELETE or ARCHIVE (Processing Mode), it would error off because the file was no longer on the FTP site. I contacted the site but they refused to deactivate their script to auto-delete files. Using TEST processing mode is not recommended per SAP in a server pool environment. You would think SAP XI would provide a fourth option in which a DELETE command is not issued back to the FTP site.

The FTP site did have sub-directories in which copies of the original files were stored, but I could not figure out how to dynamically change the XI Source Directory as the current date changed.

I settled on using File NFS (Transfer Protocol) and running the FTP commands from a .bat (batch file). I put the command I run down at the bottom of the XI page with a 60 second timeout.

I still do not change to each folder dynamically because the standard FTP (GET and MGET) commands do not attempt a Delete after file retrieval.

Perhaps using a batch file is an option you may want to consider using.

Cheers,

Ralph

Former Member
0 Kudos

Hi, Ralph

I know batch file could be a solution.

However, i was looking for another option because of command script it's difficult to monitor and control.

Thank you very much for your help.

Carme

Former Member
0 Kudos

Ralph,

Give a shot by giving source directory as 2/ which means all the directories and its files with start with 2.

Regards,

---Satish

Former Member
0 Kudos

Hi Satish,

I have a similar problem (I have a great number of source directories) and I try to apply your solution.

In source directory I have bust/000*, so I want to read several directories:

bust/0000001

bust/0000002

bust/0000003

...

But it doesn't work.

Error "FTPEx: bust/000*: No such file or directory