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

Download file From SAP Abap report tio FTP Server

Hi Friends,

i m downloading one file using GUI_UPLOAD FM i can generate in local folder.but i want to generate in ftp server folder...............

pls anybody tell me step by step how to do it

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 Jan 31, 2008 at 11:50 AM

    Hi,

    Check this code

    REPORT ZFTPSAP LINE-SIZE 132.

    DATA: BEGIN OF MTAB_DATA OCCURS 0,

    LINE(132) TYPE C,

    END OF MTAB_DATA.

    DATA: MC_PASSWORD(20) TYPE C,

    MI_KEY TYPE I VALUE 26101957,

    MI_PWD_LEN TYPE I,

    MI_HANDLE TYPE I.

    START-OF-SELECTION.

    Your SAP-UNIX FTP password (case sensitive)

    MC_PASSWORD = 'password'.

    DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.

    FTP_CONNECT requires an encrypted password to work

    CALL 'AB_RFC_X_SCRAMBLE_STRING'

    ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY

    ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD

    ID 'DSTLEN' FIELD MI_PWD_LEN.

    CALL FUNCTION 'FTP_CONNECT'

    EXPORTING

    Your SAP-UNIX FTP user name (case sensitive)

    USER = 'userid'

    PASSWORD = MC_PASSWORD

    Your SAP-UNIX server host name (case sensitive)

    HOST = 'unix-host'

    RFC_DESTINATION = 'SAPFTP'

    IMPORTING

    HANDLE = MI_HANDLE

    EXCEPTIONS

    NOT_CONNECTED = 1

    OTHERS = 2.

    CHECK SY-SUBRC = 0.

    CALL FUNCTION 'FTP_COMMAND'

    EXPORTING

    HANDLE = MI_HANDLE

    COMMAND = 'dir'

    TABLES

    DATA = MTAB_DATA

    EXCEPTIONS

    TCPIP_ERROR = 1

    COMMAND_ERROR = 2

    DATA_ERROR = 3

    OTHERS = 4.

    IF SY-SUBRC = 0.

    LOOP AT MTAB_DATA.

    WRITE: / MTAB_DATA.

    ENDLOOP.

    ELSE.

    do some error checking.

    WRITE: / 'Error in FTP Command'.

    ENDIF.

    CALL FUNCTION 'FTP_DISCONNECT'

    EXPORTING

    HANDLE = MI_HANDLE

    EXCEPTIONS

    OTHERS = 1.

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 13, 2008 at 04:35 AM

    I have made some changes in above code and it worked fine..

    mi_pwd_len = STRLEN( mc_password ).

    *-- FTP_CONNECT requires an encrypted password to work

    CALL FUNCTION 'HTTP_SCRAMBLE'

    EXPORTING

    SOURCE = mc_password

    sourcelen = mi_pwd_len

    key = '26101957'

    IMPORTING

    destination = mc_password.

    Thanks

    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.