Skip to Content
author's profile photo Former Member
Former Member

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

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 10:55 AM

    HEllo,

    Check the prog = RPCFTPM0 in SE38

    Hope this’ll give you idea!!

    P.S award the points.^

    Vasanth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 11:16 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.