How can we determine the size of a file on remote server...

Hi,

We get some .dat files from SAP Application Server. Sometimes they will be empty and when we try to use the empty files to load the DW tables we are getting some warnings stating the file is empty. We are aware of function get_file_attribute(), I think this holds good for files on JobServer. But how to use this function to check the file on remote application server.

Any help is highly appreciated.

Regards.
Santosh.


SantoshNirmala :india: (BOB member since 2006-03-15)

Just a Suggestion:

How about ftping that files from REMOTE SERVER to your JOB SERVER…

Once you done with your processing, DELETE it…


data_guy :us: (BOB member since 2006-08-19)

Hi,

Thanks for prompt reply.
Yeah, that we do while populating the tables. But I need to use this feature for validation purpose or catch the exceptions/warnings for empty files.

Thanks once again.

Regards.
Santosh.


SantoshNirmala :india: (BOB member since 2006-03-15)

Just a thought…

How about writing a CUSTOM_FUNCTION…{for FTP}

  1. Pass File name as parameter
  2. Use EXEC command call some FTP software, may be call some batch file, which have all the details; user id + password + hostname
  3. Return size of that file…

Another way to look at it… :smiley:


data_guy :us: (BOB member since 2006-08-19)

I think Data_Guy means using the SIZE command to get the remote file size. It might work, depending on the FTP server.

Syntax: size(filename)
Request the size of the file named filename on the server. On success, the size of the file is returned as an integer, otherwise None is returned. Note that the ā€œSIZEā€ command is not standardized, but is supported by many common server implementations.


dutchbint :uk: (BOB member since 2007-05-16)

Create a double global variable.
As a first step check if the file size is 0 or not through DI script object by using get_file_attribute function.

Ex:

$gv_file_size = get_file_attribute(ā€˜C:\DI_TEST\get_file_size.txt’,ā€˜SIZE’ );

print($gv_file_size);

if the $gv_file_size is 0 then do whatever you are supposed to do.

p.s. the file should be at the same computer with job server
p.s. if you want to do it on the remote server then you should write a simple script that creates a text file which holds the file names and size of the files and check this text file at the very beginning of the load. If you can give more detailed information about your system (unix & NT), i can provide the script.

k7


k7nixen :us: (BOB member since 2006-10-07)

use the R/3 datastore/dataflow to create the ABAP, execute them, download the file, read them into DI and process them further? :mrgreen:


Werner Daehn :de: (BOB member since 2004-12-17)

having same problem using the attribute function, help is deeply appreciated…

$G_File_Size = get_file_attribute(($G_FileInbound’||’\TextrFile.csv),ā€˜SIZE’ );

Cannot get this line to work


di652 (BOB member since 2005-02-24)

I would suggest you take a little time to figure out how to perform simple string manipulations, so you’re not guessing.

Play around with concatenating global variables, and also substitution variables. When concatenating I much prefer using ā€˜[$GLOBAL_VAR]\TextFile.csv’ … to using concatenation symbols. … $GLOBAL_VAR || ā€˜\’ || ā€˜TextFile.csv’

I will always separate a preceding slash included in a the middle of a concatenation into its own string. A single backslash is an escape character, so you can get some weird results if you use ā€˜\neverDoThis’. It may or may not work, but it is bad form. :wink:


jlynn73 :us: (BOB member since 2009-10-27)