‎2009 Apr 30 6:34 AM
Hi SAP Technical Guru,
my requirement, file is available at application server which i developing through FTP tool this file has to be send to legacy system.
so please tel me any standard functio module or development approach for FTP tool.
Thanks.
‎2009 Apr 30 8:09 AM
Hi,
I do not think there is a standard in SAP itself. File transfer normally depends on OS. You should do the transfer by script. After that it should be no problem to trigger this from inside SAP by ABAP code.
Here is a tiny sample code which handles file transfer from one windows based machine to another. It works with temporary mapping (drive y). real password is replaced by <pwd???> in code.
Hope it helps!
Regards Walter Habich
&----
*& Form file_to_l66
&----
FORM file_to_l66 USING src_fpath
dest_fname.
- src_fpath : full path of file which is to send
- dest_fname : filename target
DATA:
parcom(250),
BEGIN OF tabl OCCURS 0,
line(200),
END OF tabl,
str(250).
drive y free
parcom = 'y:'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF sy-subrc IS INITIAL.
RAISE file_to_l66_err_drive_y.
ENDIF.
mapping y
128.1.229.11 PiServer1
parcom =
'net use y:
128.1.229.11\SAPDATA <pwd???> /user:plr31'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_mapping_y.
ENDIF.
copying
CONCATENATE 'copy' src_fpath 'y:\' INTO str SEPARATED BY space.
CONCATENATE str dest_fname INTO parcom.
Beispiel:
src_fpath = 'e:\trans\l66.xml'
dest_fname = 'l66_20080531235959.xml'
-> parcom = 'copy e:\trans\l66.xml y:\l66_20080531235959.xml'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_mapping_y.
ENDIF.
release y
parcom =
'net use y: /delete'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_unmapping_y.
ENDIF.
ENDFORM. "
‎2009 Apr 30 8:09 AM
Hi,
I do not think there is a standard in SAP itself. File transfer normally depends on OS. You should do the transfer by script. After that it should be no problem to trigger this from inside SAP by ABAP code.
Here is a tiny sample code which handles file transfer from one windows based machine to another. It works with temporary mapping (drive y). real password is replaced by <pwd???> in code.
Hope it helps!
Regards Walter Habich
&----
*& Form file_to_l66
&----
FORM file_to_l66 USING src_fpath
dest_fname.
- src_fpath : full path of file which is to send
- dest_fname : filename target
DATA:
parcom(250),
BEGIN OF tabl OCCURS 0,
line(200),
END OF tabl,
str(250).
drive y free
parcom = 'y:'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF sy-subrc IS INITIAL.
RAISE file_to_l66_err_drive_y.
ENDIF.
mapping y
128.1.229.11 PiServer1
parcom =
'net use y:
128.1.229.11\SAPDATA <pwd???> /user:plr31'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_mapping_y.
ENDIF.
copying
CONCATENATE 'copy' src_fpath 'y:\' INTO str SEPARATED BY space.
CONCATENATE str dest_fname INTO parcom.
Beispiel:
src_fpath = 'e:\trans\l66.xml'
dest_fname = 'l66_20080531235959.xml'
-> parcom = 'copy e:\trans\l66.xml y:\l66_20080531235959.xml'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_mapping_y.
ENDIF.
release y
parcom =
'net use y: /delete'.
CALL 'SYSTEM' ID 'COMMAND' FIELD parcom
ID 'TAB' FIELD tabl-sys.
IF NOT sy-subrc IS INITIAL.
RAISE file_to_l66_err_unmapping_y.
ENDIF.
ENDFORM. "