Ansicht
Dokumentation

03785 - SAP FTP

03785 - SAP FTP

General Data in Customer Master   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

SAP FTP

Hi Martin,
here is some code.

BM__Toc528476054Using SAP FTP programs
Instead of using SYSTEM command (reserved for internal use only )
for executing an FTP script at the Operating system level, SAP has supplied
standard programs.
Programs : RSFTP010, RSFTP020, RSFTP030.
Among the three RSFTP020 has all the FTP paramaters as input and
is more user friendly.

Input paramaters and their use is

User

Password

Host

Command 1 lcd
Command 2 cd

Command 3 put

Destination SAPFTP

SAPFTP is an RFC destination supplied by SAP.

Make sure that is configured to start is application server.

But if FTP source file is stored in the local machine,

set the SAPFTP start in Front end workstation.

SAPFTP configuration path.

SM59 -> TCP/IP connections.

select SAPFTP





BM__Toc528476055FTP by abap.
REPORT YFTP1 .

* FTP by abap.
* This program passses host, user, source/target
* directory and file parameters to a UNIX script which
* in turn gets the required file from the host by ftp.
* The unix script should look like this:
*
* #! /bin/sh
* ftp -n $1 << !!
* user $2 $3
* cd .. <-- only for mainframe ftp
* get $4 $5
* quit
* !!
*
* placed in the adm path, preferably under
* /sapmnt//exe. In order to make this program
* work please create sapcpic/manager cpic user and
* apply note no. 41770.
*

PARAMETERS: HOST(10) OBLIGATORY LOWER CASE,
USER(8) OBLIGATORY LOWER CASE,
PASSWORD(8) OBLIGATORY LOWER CASE,
SRC_FILE(45) OBLIGATORY LOWER CASE,
TRG_FILE(45) DEFAULT '/usr/sap/trans/data/??????' OBLIGATORY LOWER CASE,
BIN AS CHECKBOX.
DATA: JC(8), FLG(1), B(128), PRNAME(128), LOGFILE(30), AAA(40).

DATA: BEGIN OF A,
1(12), 2(10), 3(10), 4(47), 5(47),
END OF A.

IF HOST = 'zxaq'.
IF BIN = 'X'.
PRNAME = 'ftp_bin_vms'.
ELSE.
PRNAME = 'ftp_asc_vms'.
ENDIF.
ELSE.
IF BIN = 'X'.
PRNAME = '/usr/sap/trans/bin/ftp_bin_unix'.
ELSE.
PRNAME = '/usr/sap/trans/bin/ftp_asc_unix'.
ENDIF.
ENDIF.

A-1 = HOST.
A-2 = USER.
A-3 = PASSWORD.
A-4 = SRC_FILE.
A-5 = TRG_FILE.
CONDENSE A.
B = A.

CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = 'FTP'
IMPORTING
JOBCOUNT = JC.

CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
AUTHCKNAM = SY-UNAME
EXTPGM_NAME = PRNAME
EXTPGM_PARAM = B
EXTPGM_SYSTEM = 'jupiter'
JOBCOUNT = JC
JOBNAME = 'FTP'.

CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = JC
JOBNAME = 'FTP'
STRTIMMED = 'X'
TARGETSYSTEM = 'jupiter'
IMPORTING
JOB_WAS_RELEASED = FLG.

LOGFILE = '/tmp/ftp.log'.
DO.
OPEN DATASET LOGFILE FOR INPUT IN TEXT MODE.
IF SY-SUBRC = 0. EXIT. ENDIF.
ENDDO.

DO.
READ DATASET LOGFILE INTO AAA.
IF SY-SUBRC = 0. WRITE / AAA. ENDIF.
IF AAA = 'FTP completed'. EXIT. ENDIF.
ENDDO.

CLOSE DATASET LOGFILE.

delete dataset logfile.

I hope this will help you.

kind regards

Karl Grauer
Amphenol-Tuchel Electronics
August-Haeusser-Str. 10
DE 74080 Heilbronn
phone: +49 7131/929327
mailto:karl.grauerZa... <mailto:karl.grauerZa...>
www.amphenol.com




-----Ursprüngliche Nachricht-----
Von: Martin Brieger [mailto:Martin.BriegerZm...]
Gesendet am: Dienstag, 6. November 2001 16:19
An: DoNotReply@consolut.eu
Betreff: SAP FTP
Hi Guys,

I would like to receive a file from an external system from within an ABAP
program.
Anyone out there who might have a little bit of source code on how to do it?
I would want to avoid the OS level, if possible.

All I would really need would be a working example of some FTP function.


Thanks

Martin





Durban Tours - Südafrika Safari

ROGBILLS - Synchronize billing plans   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 4802 Date: 20240419 Time: 034356     sap01-206 ( 3 ms )