OK.  Here goes.

This is the relevant portion of the ftp script.  The SAP ABAP program executes a 
system call to execute this script.  It passes in things like the userid, remote 
host name, remote and local file names, password, get or put command, etc.  This 
is the piece of the script that we modified to add the status command.

ftp - n $openhost <<endofdata >/tmp/ftpout
user $userid
$putcmds
status
bye
endofdata
cat /tmp/ftpout
exit 0

The output of the status command and any errors generated from the ftp command 
itself are passed back to the calling SAP program by doing the cat command.  SAP 
returns the output in an internal table format.  One table record for each line 
of the file.

Here is the relevant SAP ABAP code that is parsing the returned data.  It's 
doing some other things for our environment so I just pulled the lines that are 
looking at the returned information.

loop at tabl.
  temp_line = tabl-line.
  translate temp_line to upper case.
  if sy-tabix = 1.       "Connected status should be the first line
    if temp_line cs 'CONNECTED TO'.
                      "This is a substring command meaning  contains
      connect_sw = '1'.
    elseif temp_line cs 'NOT CONNECTED'.
      noconnect_sw = '1'.
*    else    "Must be other mesages in first line.  May be error
    endif.
  endif.
endloop.

if connect_sw = 0.
  if noconnect_sw = 1.
    write: / 'The file transfer appears to have been interupted. ',
             'Please check the completeness of your data.'.
    skip 2.
  endif.
endif.

The key is looking for the CONNECTED TO or NOT CONNECTED message as the first 
line returned.

Hope this helps.

Shari Dishop
SAP ABAP - Project Systems Team  (Former DBA/Designer/Developer)
Logicon - A Northrop Grumman Company
Baltimore, MD



RE:

Would it be possible for you to send me a copy of how you are using the status
command?  I have tried, but I am obviously doing it wrong, as I am not getting 
what
I expect.

Terry

Shari Dishop wrote:

> Terry,
>   I worked on what I think is a similar process.  We are running SAP and need 
to
> be able to ftp files on and off of our unix SAP servers.  Someone in the past
> wrote an SAP ABAP program that does all of the set up then calls a unix shell
> script to perform the ftp.  If the ftp command truely failed to connect we had
> no problem getting back a failed error message to the SAP program.  But where 
we
> ran into some problems was when the transfer command would start but get
> interrupted for some unknown reason and never fully complete the transfer.  
This
> was noticed by accident one day when someone was checking a report run off of
> one of the data transfers and there were only a few hundred records in the 
table
> to be processed instead of a few hundred thousand.
>
>   I was then asked to come up with a solution that would look for an 
unexpected
> termination of the ftp connection.  After lots of searching and getting one of
> our local unix gurus involved (I have worked directly on a unix platform), we
> implemented the following.  It is not the best but it does seem to be working.
>
>   We added a step to the ftp script.  This step is a status command that is
> executed directly after the get or put command.  This returns information 
about
> the ftp connection itself.  It also returns a message if it is no longer
> connected.  This output was passed back to the SAP program and parsed.  If I 
had
> a message indicating that the remote host was still connected, I assumed that
> the get or put executed completely.  If on the other hand I received the 
message
> indicating that the remote system was no longer connected I generated an error
> message from the program so that the user could check the data.
>
> Shari Dishop
> SAP ABAP - Project Systems Team
> Logicon - A Northrop Grumman Company
> Baltimore, MD

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Shari Dishop
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to