This time the problem is: I had to periodically read an ftp folder for inbound idoc files to process with Sap; the simpliest way to process an inbound idoc file is with a call of the program startrfc.exe, that you can find on every Sap installation executables folder, passing the following parameters:
startrfc -3 -d <sys_id> -u <sap_rfc_user> -p <password>
-c <mandt> -l <login_language, E for English> -h <sap_host_name>
-s <system_number> -F EDI_DATA_INCOMING
-E PORT=<edi_port> -E PATHNAME=<file_path>
But this call process only a single file, it doesn’t admit “<drive>/<file_directory>/*.*” like strings as PATHNAME.
I solved the problem using the dos command “FORFILES” (scheduled every n minutes); here is the batch script:
FORFILES -p <folder_path> -m * -c "startrfc -3 -d <sys_id> -u <sap_rfc_user> -p <password> -c <mandt> -l <login_language> -h <sap_host_name> -s <system_number> -F EDI_DATA_INCOMING -E PORT=<edi_port> -E PATHNAME=\\<host>\<folder>\...\\@FILE"
In my specific scenario there was some other points to take care of:
- I had to read from a network smb shared folder (of an ftp server) but the <folder_path> is not admitted as “\\<host>\<path>” so I had to map a network drive;
- at the opposite front the PATHNAME of the EDI_DATA_INCOMING function call doesn’t admit mapped network drive so I built the files path this way: \\<host>\<folder>\…\\@FILE , instead of simply using the @PATH of the FORFILES command; It’s mandatory to use a double back-slash \\ before the @FILE parameter to get the script working.
- the -m * parameter is used as mask for file names, I used “*” to process all files, even without extensions.
As ever I hope this could help someone out there!
I would like to exchange links with your site lnx.acidsoft.net
Is this possible?