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

placing a file

hi gurus,

an xml file is being spit from an abap program, instead of putting it on the desktop,

it needs to be placed in FTP server.

can some one help me with this.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 07:10 PM

    Hi Sanjana,

    Use this program RPCFTPM0

    You can get all FTP related programs in package SFTP.

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 07:20 PM

    Hi

    Here is the sample code to send FTP

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 07:30 PM

    so u mean that every time we want to upload a file to FTP server, we do it through the following three call-functions:

    FTP_CONNECT

    FTP_COMMAND

    FTP_DISCONNECT

    thank you.

    Add a comment
    10|10000 characters needed characters exceeded

    • Sanjana,

      This all depends on your business requirement,

      Case1: (Recommended)

      Normally FTP things(Most of the places), will be done from unix level, So you will download the file to application server, and in UNIX you will have a script to perorm FTP action .

      If you run your abap program as batch job, you need to create new step for the external command and give unix shell script there. It will take care of the rest.

      PLEASE CONTACT YOUR BASIS TEAM for this case.

      Case2:

      Sometimes you will need to FTP from abap, in that case my program will work, but you need to give FTP server username and password here.

      Award points if helpful.

      Thanks,

      Pavan

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 07:41 PM

    Sanjana,

    If you have the file on the your local system if you want to upload it onto server just use the tcode

    CG3Z.

    just give the local file path and server path... u will get it there

    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.