Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

want to transer pdf file from sap application servert to ftp server

laxman_sankhla3
Participant
0 Kudos
257

hi

i want to transer pdf file from sap application servert to ftp server.

is there any function module than please suggest me.

how to use that function module and which parameter i has to pass.

thanks in advance.

3 REPLIES 3

Former Member
0 Kudos
109

HEllo,

Check the prog = RPCFTPM0 in SE38

Hope this’ll give you idea!!

P.S award the points.^

Vasanth

0 Kudos
109

hi

in this report what i hase to pass for parameter

command.

company.

thanks to reply.

Former Member
0 Kudos
109

hi,

CHK this code.

REPORT ZTEMP .

DATA : HDL TYPE I.

DATA : V_DSTLEN TYPE I, X_PWD(64) TYPE C.

DATA: V_CMD(80) TYPE C.

DATA: V_PATH LIKE SXPGCOLIST-PARAMETERS.

DATA: V_FILE LIKE RLGRAP-FILENAME.

DATA: V_ERROR(1) TYPE C.

DATA: I_MESSAGES LIKE SOLI OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF IT_RESULT OCCURS 0,

LINE(100) TYPE C.

DATA: END OF IT_RESULT.

DATA: KEY TYPE I VALUE 26101957.

CONSTANTS: V_HOST(64) TYPE C VALUE 'ftp.yahoo.com'.

CONSTANTS: V_USER(64) TYPE C VALUE 'user'.

CONSTANTS: V_PWD(64) TYPE C VALUE 'password'.

START-OF-SELECTION.

V_PATH = '
APP_SERVER\INTERFACE\TEMP\'.

V_FILE = '1.txt'.

PERFORM FTP_TO_OBE.

LOOP AT I_MESSAGES.

WRITE 😕 I_MESSAGES-LINE.

ENDLOOP.

***************************

  • FTP CONNECTION

***************************

FORM FTP_TO_OBE.

CLEAR: V_DSTLEN, X_PWD.

DESCRIBE FIELD V_PWD LENGTH V_DSTLEN.

  • To convert password into encrypted password

CALL 'AB_RFC_X_SCRAMBLE_STRING'

ID 'SOURCE' FIELD V_PWD

ID 'KEY' FIELD KEY

ID 'SCR' FIELD 'X'

ID 'DESTINATION' FIELD X_PWD

ID 'DSTLEN' FIELD V_DSTLEN.

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

USER = V_USER

PASSWORD = X_PWD

HOST = V_HOST

RFC_DESTINATION = 'SAPFTP' " create using report program RSFTP002

IMPORTING

HANDLE = HDL

EXCEPTIONS

NOT_CONNECTED = 1

OTHERS = 2.

WRITE : / ' sy-subrc ' , SY-SUBRC.

WRITE : / 'hdl' , HDL.

IF SY-SUBRC = 0.

CLEAR V_CMD.

CONCATENATE 'lcd' V_PATH INTO V_CMD SEPARATED BY SPACE.

PERFORM FTP_COMMAND USING V_CMD.

CLEAR V_CMD.

CONCATENATE 'put' V_FILE INTO V_CMD SEPARATED BY SPACE.

PERFORM FTP_COMMAND USING V_CMD.

ELSE.

V_ERROR = 'X'.

CONCATENATE 'Not connected to ftp: world finest '

'user:'

INTO I_MESSAGES SEPARATED BY SPACE.

APPEND I_MESSAGES.

CLEAR I_MESSAGES.

ENDIF.

ENDFORM. " FTP_TO_OBE

***************************

  • FTP COMMAND

***************************

FORM FTP_COMMAND USING V_CMD.

CLEAR IT_RESULT.

REFRESH IT_RESULT.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

HANDLE = HDL

COMMAND = V_CMD

TABLES

DATA = IT_RESULT

EXCEPTIONS

TCPIP_ERROR = 1

COMMAND_ERROR = 2

DATA_ERROR = 3

OTHERS = 4.

IF SY-SUBRC = 0.

CONCATENATE 'FTP command:'

'executed on host:'

INTO I_MESSAGES SEPARATED BY SPACE.

APPEND I_MESSAGES.

CLEAR I_MESSAGES.

loop at it_result.

I_MESSAGES = IT_RESULT.

APPEND I_MESSAGES.

CLEAR I_MESSAGES.

endloop.

CLEAR IT_RESULT.

REFRESH IT_RESULT.

ELSE.

V_ERROR = 'X'.

CONCATENATE 'Command:'

'not run for host:'

INTO I_MESSAGES SEPARATED BY SPACE.

APPEND I_MESSAGES.

CLEAR I_MESSAGES.

ENDIF.

ENDFORM. " FTP_COMMAND

hope this helps.

PLZ reward if helpful.