To Transfer files between SAP System and PC in background
Preparation :
You need the RFC-SDK to be installed on the PC. The RFC-SDK is installed as a component during setup of your SAPGUI. If the RFC-SDK is already installed on you PC you will find a directory :
Configure saprfc.ini:
The information about posibble RFC-Destinations is kept in file named saprfc.ini
(located on
Windows 2000 & XP :
Set Environtment Variable :
Variable : RFC_INI
Value :
My Computer -> Properties -> Advanced -> Environment Variables.
Windows 98:
Add :
SET RFC_INI=
To :
AUTOEXEC.BAT
Saprfc.ini :
/*===================================================================*/
/* Type R: Register a RFC server program at a SAP gateway */
/* or connect to an already registered RFC server program */
/* For Transfer file From SAP to Cognos.
/*===================================================================*/
DEST=RFC_150
TYPE=R
PROGID=oracle_server.rfcexec
GWHOST=10.1.10.8
GWSERV=sapgw00
RFC_TRACE=0
Note: Create Entry for each Server SAP.
Configure RFC Destination(sm59):
Connection Type : T
Activation Type : Registration
On Destination PC :
Start rfcsdk :
rfcsdk –D
Sample Code For Test :
ZTEST_RFCDOWNLOAD :
REPORT ztest_rfcdownload .
TABLES: t001.
DATA: p_file TYPE rlgrap-filename VALUE 'E:\PYDATA\TEST001.TXT'.
DATA: p_dest TYPE rfcdes-rfcdest VALUE 'PINGUIN.RFCEXEC'.
DATA: it_t001 LIKE t001 OCCURS 0.
DATA: errmsg(120).
SELECT * FROM t001.
APPEND t001 TO it_t001.
ENDSELECT.
CALL FUNCTION 'RFC_REMOTE_FILE'
DESTINATION p_dest
EXPORTING
file = p_file
write = 'X'
TABLES
filedata = it_t001
EXCEPTIONS
system_failure = 1 MESSAGE errmsg
communication_failure = 2 MESSAGE errmsg.
write:/ sy-subrc.
NOTE :
Function Module “RFC_REMOTE_FILE” connot be debugging, because
“RFC_REMOTE_FILE” is a C-language on destination PC.
No comments:
Post a Comment