cancel
Showing results for 
Search instead for 
Did you mean: 

File-FTP command before message processing

Former Member
0 Kudos

Hi experts,

my requirement is as follow :

i have 5 files on my FTP server. All are named FILE_hhssmm.xml

In the configuration of my CC out, i have put as specific file name to get picked 1*.xml

I need a command line in the 'run operating system command before message processing' that renames one of the files as 1FILE_hhssmm.xml so that the files get picked one by one.

I can not manage to do that, i only managed to write a batch file but i only can run it locally...

please, any help would be greatly appreciated...

Kindly,

Jamal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Mostly likely it's authorization issue. Make sure that the user (<sid>adm in Unix or SAPService<SID> in windows) has the right to run your batch program (or the copy command) and has the right to rename the specified xml files.

Former Member
0 Kudos

BTW, remember that the OS command is executed in the PI box, so ftp receiver/sender directory must be accessible from the PI system

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

when I try to launch the .bat file directly from the FTP, it does not work. The action of renaming doesnt work, and the dos windows closes too fast so I cant read what happens.

By the way, the OS of my FTP is windows.

I cant seem to get through this...

Thanks for any help,

Jamal

Former Member
0 Kudos

Hi

This OSS note 841704 explains the possibilities why OS command scripts may not be executed,

check the other option which I have explained above, for moving file to a child folder and XI picking it up from there.

all the best

Regards

Vishnu

Former Member
0 Kudos

Hi Jamal,

This suggestion might look silly. But try to give the full directory path of your batch file (myscript.bat) in the 'command line' text box.

Also the other point is, I doubt whether you can directly access the files on FTP server and process them from within your batch file as this will be run on PI box and not on FTP server box. Incase you really want, I guess you need to login to the FTP server within the script and then rename those files.

Good luck.

Cheers,

Vijendra

Former Member
0 Kudos

Hi,

yes ive been trying hard, but no results so far

You say it is quite simple to let the .bat file be scheduled by the scheduler of your OS, but im kinda new at this, and I dont really know how it works.

I dont understand why XI wont launch my .bat, nothing happens

maybe it isnt possible to execute a .bat from a ftp server ?

do you see any other way ?

Thanks again,

Jamal

Former Member
0 Kudos

Hi

Whats the OS of your ftp server??

If it is unix, linux etc the commands would be different and may not work for the same command/code which works in windows.

In that case, you have to adapt your script as per your OS.

Regards

Vishnu

Former Member
0 Kudos

Hi,

First run the script from the PI box directly at OS level. Check it is running without errors.

Later you run the script from CC. If it is not still not working then check the default trace files from the following paths where you can get the exact reason whether it is authorization issue or any configuration error.

1.usr/SAP/SID or X7 system name/DVEBMGS07/J2EE//cluster/server0/log/defaulttrace.trc

2.usr/SAP/SID or X7 system name/DVEBMGS07/J2EE//cluster/dispatcher/log/defaulttrace.trc

Thanks,

Jogula Ramesh

Former Member
0 Kudos

Thanks, but it looks like my command is not executed, I get no trace in the communication channel log, just the polling

I have put 'myscript.bat' in thecommand line before message processing, is it correct ?

here is the code of my script :


@echo off

set vrFchSource=*.xml


setlocal enableDelayedExpansion 

for %%i in ("%vrFchSource%") do ( 

                  if exist "%%i" (
  
                                   set /a vrNumb+=1  
    
                                   ren "%%i" "!vrNumb!-%%~nxi"
  ) )


endlocal

It adds a number before the files, so that I can handle the one that starts with '1'. But i cant get my bat file to be executed on my FTP folder where there are my files

Any help would be greatly appreciated

Regards,

Jamal

Former Member
0 Kudos

Hi

I have been following this for a while (from other posts as well), you are trying quite hard to get this done

I have couple of ideas...

If you think that this is not going to work, then you can try another solution,

- let the .bat file be scheduled by the scheduler of your OS (this is quite simple) say every 30 mins

- make the .bat file move your input files from your current folder to a child folder

- let XI poll the child folder, every 5 secs or so... anyway your scheduler will send the file only after every 30 mins

- Now you need not rely on the OS command from the Fileadpater of XI

My suspicion (though it is not documented anywhere in help, as far as I know) is that the OS command executes only if there is proper reading of the file (or its presence as per the configuration in adapter settings) & not per polling of the adapter. I infer this from your previous post. but your requirement is peculiar that though the file is present that itself has to have a different name - to be read by adapter...some kind of clashes ??!!.

The problem could be something else also, but the above is a possibility as well..

all the best

Regards

Vishnu

Former Member
0 Kudos

Even if you are using FTP adapter. The OS Command will be executed locally. Not on FTP server.