FTP_CONNECT

Hello, everyone.
While activating FM HTTP_CONNECT I get an error message that my user has no authorization for the remote ftp computer althogh via cmd I'm connecting the same ftp computer successfully.
Does anyone know why ??
Here's my code:
*--> Scramble ftp password
  SET EXTENDED CHECK OFF.
  LV_LEN = STRLEN( FTP_PSS ).
  CALL FUNCTION 'HTTP_SCRAMBLE'
    EXPORTING
      SOURCE         = FTP_PSS
      SOURCELEN   = LV_LEN
      KEY                = '26101957'
    IMPORTING
      DESTINATION  = FTP_PSS.
*--> Connect to FTP server
  CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      USER            = FTP_USR
      PASSWORD  = FTP_PSS
      HOST            = FTP_ADR
      RFC_DESTINATION = ''SAPFTP'
    IMPORTING
      HANDLE          = LV_HDL
    EXCEPTIONS
      NOT_CONNECTED.

Hi,
Check out this , may be helpful to you
CALL FUNCTION 'FTP_CONNECT'
       EXPORTING
            user            = user
            password        = pwd
            host            = host
            rfc_destination = dest
       IMPORTING
            handle          = hdl
       EXCEPTIONS
            not_connected   = 8.
  CASE sy-subrc.
    WHEN 0.
    WHEN OTHERS.
      RAISE connection_error.
  ENDCASE.
  CALL FUNCTION 'FTP_COMMAND'
       EXPORTING
            handle        = hdl
            command       = transfer_type
       TABLES
            data          = data
       EXCEPTIONS
            command_error = 1
            tcpip_error   = 2
            data_error    = 3.
  CASE sy-subrc.
    WHEN 0.
    WHEN 1.
      RAISE command_error.
    WHEN 2.
      RAISE tcpip_error.
    WHEN 3.
      RAISE data_error.
    WHEN OTHERS.
      RAISE other_error.
  ENDCASE.
  CALL FUNCTION 'FTP_COMMAND'
       EXPORTING
            handle        = hdl
            command       = ftp_command
            compress      = compress
            verify        = verify
       TABLES
            data          = data
       EXCEPTIONS
            command_error = 1
            tcpip_error   = 2
            data_error    = 3.
  CASE sy-subrc.
    WHEN 0.
    WHEN 1.
      RAISE command_error.
    WHEN 2.
      RAISE tcpip_error.
    WHEN 3.
      RAISE data_error.
    WHEN OTHERS.
      RAISE other_error.
  ENDCASE.
  CALL FUNCTION 'FTP_DISCONNECT'
       EXPORTING
            handle = hdl.
Thanks
Aditya

Similar Messages

  • Error in background job while running FTP_CONNECT

    Dear Friends,
    When I try to run the FTP_CONNECT  FM in background,
    the ftp server is not connected throwing an error message ''Attempt to set up connection to <ftpserver> failed''.
    I am using the RFC destination SAPFTPA and still it is not working!
    My program was successfully executing in fore ground with SAPFTP.
    Please help.
    Thanks and Regards,
    Vidya Sagar.

    Hi,
    The below program is to create file on FTP server by taking the data from internal table
    To see whether the file is created on the FTP server
    use the function module FTP_SERVER_TO_R3.
    Check the below code.
    You write a same program with the function module FTP_SERVER_TO_R3 instead of
    FTP_R3_TO_SERVER to check the existence of the file which is already created.
    tables: t777a.                        "Building Addresses
    Internal Table for  Building table.
    data: begin of it_t777a occurs 0,
            build like t777a-build,       "Building
            stext like t777a-stext,       "Object Name
            cname like t777a-cname,       "Address Supplement (c/o)
            ort01 like t777a-ort01,       "City
            pstlz like t777a-pstlz,       "Postal Code
            regio like t777a-regio,       "Region (State, Province, County)
          end of it_t777a.
    Internal Table for taking all fields of the above table in one line
    separated by u2018|u2019(pipe).
    data: begin of it_text occurs 0,
          text(131),
          end of it_text.
    Constants: c_key  type i value 26101957,
               c_dest   type rfcdes-rfcdest value 'SAPFTPA'.
    data: g_dhdl type i,      "Handle
          g_dlen type i,      "pass word length
          g_dpwd(30).         "For storing password
    Selection Screen Starts
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
    parameters: p_user(30) default 't777a'          obligatory,
                p_pwd(30)  default 't777a'          obligatory,
                p_host(64) default 'XXX.XXX.XX.XXX' obligatory.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.
    parameters: p_file like rlgrap-filename default 't777a_feed.txt'.
    SELECTION-SCREEN END OF BLOCK blk2.
    Password not visible.
    at Selection-screen output.
      loop at screen.
        if screen-name = 'P_PWD'.
          screen-invisible = '1'.
          modify screen.
        endif.
      endloop.
    g_dpwd  = p_pwd.
    Start of selection
    start-of-selection.
    To fetch the data records from the table T777A.
      select build stext cname ort01 pstlz regio
             from t777a
             into table it_t777a.
    Sort the internal table by build.
      if not it_t777a[] is initial.
        sort it_t777a by build.
      endif.
    Concatenate all the fields of above internal table records in one line
    separated by u2018|u2019(pipe).
      loop at it_t777a.
        concatenate it_t777a-build it_t777a-stext it_t777a-cname
                    it_t777a-ort01 it_t777a-pstlz it_t777a-regio
                    into it_text-text separated by '|'.
        append it_text.
        clear it_text.
      endloop.
    To get the length of the password.
      g_dlen = strlen( g_dpwd ).
    Below Function module is used to Encrypt the Password.
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = g_dpwd          "Actual password
          SOURCELEN   = g_dlen
          KEY         = c_key
        IMPORTING
          DESTINATION = g_dpwd.         "Encyrpted Password
    *Connects to the FTP Server as specified by user.
      Call function 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          text = 'Connecting to FTP Server'.
    Below function module is used to connect the FTP Server.
    It Accepts only Encrypted Passwords.
    This Function module will provide a handle to perform different
    operations on the FTP Server via FTP Commands.
      call function 'FTP_CONNECT'
        EXPORTING
          user            = p_user
          password        = g_dpwd
          host            = p_host
          rfc_destination = c_dest
        IMPORTING
          handle          = g_dhdl
         EXCEPTIONS
            NOT_CONNECTED.
      if sy-subrc ne 0.
        format color col_negative.
        write:/ 'Error in Connection'.
      else.
        write:/ 'FTP Connection is opened '.
      endif.
    **Transferring the data from internal table to FTP Server.
      CALL FUNCTION 'FTP_R3_TO_SERVER'
        EXPORTING
          HANDLE         = g_dhdl
          FNAME          = p_file
          CHARACTER_MODE = 'X'
        TABLES
          TEXT           = it_text
        EXCEPTIONS
          TCPIP_ERROR    = 1
          COMMAND_ERROR  = 2
          DATA_ERROR     = 3
          OTHERS         = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        write:/ 'File has created on FTP Server'.
      ENDIF.
    Call function 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          text = 'File has created on FTP Server'.
    To Disconnect the FTP Server.
      CALL FUNCTION 'FTP_DISCONNECT'
        EXPORTING
          HANDLE = g_dhdl.
    To Disconnect the Destination.
      CALL FUNCTION 'RFC_CONNECTION_CLOSE'
        EXPORTING
          destination = c_dest
        EXCEPTIONS
          others      = 1.
    Regards,
    Kumar Bandanadham

  • Urgent: Error in FM FTP_CONNECT

    Hello Experts,
    I am trying to connect SAP server with external FTP server using FM FTP_CONNECT.
    I'm passing following parameters to the FM:
    user = p_user
    password = p_password
    host = ip address of FTP server
    rfc_destination = SAPFTPA
    p_user and p_password are blank, since no userid and password are required
    to access the FTP server.
    The FM is giving the following error:
    Attempt to setup connection to FTP server failed.
    I can access the FTP server directly from my machine through run.
    I have tried programs RSFTP002 and RSFTP004. They are giving the same error.
    Basically, inside the FM FTP_CONNECT, the system again calls the FM.
    CALL FUNCTION 'FTP_CONNECT' DESTINATION RFC_DESTINATION
         EXPORTING USER = USER PWD = PASSWORD ACCT = ACCOUNT HOST = HOST
                   TRACE = FTP_TRACE GUSER = GATEWAY_USER
                   GPWD = GATEWAY_PASSWORD GHOST = GATEWAY_HOST
         IMPORTING HANDLE = HANDLE ERROR = CERROR
         EXCEPTIONS SYSTEM_FAILURE = 1 COMMUNICATION_FAILURE = 2.
    Here it is returning CERROR = 2.
    sy-subrc is 0.
    Can anybody please help? Its really urgent.

    HI SANTOSH,
    I had changed according what u said and it is not giving runtime error .
    but it is not giving the value as if i send the value of batch and the prd orderr. plz tell me how do it get the output.
    i had written the code of program like this:-
    TABLES : CHVW.
    Parameters : P_CHARG like CHVW-CHARG,
                 P_AUFNR like CHVW-AUFNR.
    DATA: PRD LIKE CHVW-AUFNR.
    CALL FUNCTION 'ZFIND_PRDORD'
    EXPORTING
    QP_CHARG = P_CHARG
    P_AUFNR = P_AUFNR
    IMPORTING
    P_RETVAL = PRD.
    WRITE : / PRD .
    PLZ HELPMEOUT HOW TO DO THIS.

  • FTP_CONNECT taking more time

    Hi Folks
    I have coded in a user exit of PR application(ME51N) for downloading the PR details to other system using FTP function modules. But FTP_CONNECT function module taking much time to connect to the other system results in low performance while creating PRs.
    So please suggest me how to solve this.
    Is there any way to run this FTP parallel to the application without interrupting the PR creation application.
    Thanks in advance.

    Hi Rob,
    Thanks for your quick response. Below is the code i have in a user exit which trigger while saving the PR.
         user = 'user'.
         password = '******'.
         host = 'host'.
         rfc_destination = 'destination'.
          l_pwd = password.
          l_slen = STRLEN( l_pwd ).
          TRANSLATE l_pwd TO LOWER CASE.
    TRANSLATE user TO LOWER CASE.
    HTTP_SCRAMBLE: This is used to scramble the password provided into a
    format which is been recognized by SAP.
          CALL FUNCTION 'HTTP_SCRAMBLE'
            EXPORTING
              SOURCE      = l_pwd
              sourcelen   = l_slen
              key         = c_key
            IMPORTING
              destination = l_pwd.
    FTP_CONNECT : This function module is used to connect to other system
    from SAP with the help of Userid & amp; scrambled password & Host
    string & destination (default 'SAPFTP').
    To Connect to the Server using FTP
          CALL FUNCTION 'FTP_CONNECT'
            EXPORTING
              user            = user
              password        = l_pwd
              host            = host
              rfc_destination = rfc_destination
            IMPORTING
              handle          = w_hdl
            EXCEPTIONS
              OTHERS          = 1.
          IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            EXIT.
          ENDIF.
    Set Passive mode
          CALL FUNCTION 'FTP_COMMAND'
            EXPORTING
              handle        = w_hdl
              command       = 'set passive on'
            TABLES
              data          = it_result
            EXCEPTIONS
              tcpip_error   = 1
              command_error = 2
              data_error    = 3.
          IF sy-subrc EQ 0.
          ENDIF.
          REFRESH it_result.
    Set ascii mode
          CALL FUNCTION 'FTP_COMMAND'
            EXPORTING
              handle        = w_hdl
              command       = 'ascii'
            TABLES
              data          = it_result
            EXCEPTIONS
              tcpip_error   = 1
              command_error = 2
              data_error    = 3.
          IF sy-subrc EQ 0.
          ENDIF.
          CLEAR file.
          CONCATENATE filename 'RequisitionHeader' '.csv' INTO file.
          CONDENSE file NO-GAPS.
          CLEAR: it_final,
                 it_csvfile.
          REFRESH: it_final,
                   it_csvfile.
          PERFORM upload_from_server TABLES it_final
                                     USING  file
                                            w_hdl.
          IF it_final[] IS INITIAL.
            CLEAR v_line.
      v_line = 'Requisition_Number,Req_Creation_Date,Requester,
    RequesterPasswordAdapter,Preparer,PreparerPasswordAdapter,Title'.
            CONDENSE v_line NO-GAPS.
            APPEND v_line TO it_final.
          ENDIF.
          CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
            EXPORTING
              i_field_seperator    = ','
            TABLES
              i_tab_sap_data       = it_csvhead
            CHANGING
              i_tab_converted_data = it_csvfile
            EXCEPTIONS
              conversion_failed    = 1
              OTHERS               = 2.
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          LOOP AT it_csvfile INTO v_line.
            APPEND v_line TO it_final.
            CLEAR v_line.
          ENDLOOP.
          PERFORM download_to_server TABLES it_final
                                     USING  file
                                            w_hdl.
          CLEAR file.
          CONCATENATE filename 'RequisitionDetail' '.csv' INTO file.
          CONDENSE file NO-GAPS.
          CLEAR: it_final,
                 it_csvfile.
          REFRESH: it_final,
                   it_csvfile.
          PERFORM upload_from_server TABLES it_final
                                     USING  file
                                            w_hdl.
          IF it_final[] IS INITIAL.
    v_line  = 'Requisition_Number,Line_Number,Need_By_Date,Commodity_Code,
    Quantity,Unit_Price,Unit_Price_Currency,Unit_Of_Measure,Ship_To,
    Deliver_To,Item_No,Item_Description,SupplierPartNumber,Account_Category,
    Purchase_Group'.
            CONDENSE v_line NO-GAPS.
            APPEND v_line TO it_final.
          ENDIF.
          CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
            EXPORTING
              i_field_seperator    = ','
            TABLES
              i_tab_sap_data       = it_csvitem
            CHANGING
              i_tab_converted_data = it_csvfile
            EXCEPTIONS
              conversion_failed    = 1
              OTHERS               = 2.
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          LOOP AT it_csvfile INTO v_line.
            APPEND v_line TO it_final.
            CLEAR v_line.
          ENDLOOP.
          PERFORM download_to_server TABLES it_final
                                     USING  file
                                            w_hdl.
          CLEAR file.
         CONCATENATE filename 'RequisitionSplitAccounting' '.csv' INTO file.
          CONDENSE file NO-GAPS.
          CLEAR: it_final,
                 it_csvfile.
          REFRESH: it_final,
                   it_csvfile.
          PERFORM upload_from_server TABLES it_final
                                     USING  file
                                            w_hdl.
          IF it_final[] IS INITIAL.
    v_line  =  'Requisition_Number,Line_Number,Split_Line_Number,Percentage,
    Amount,Amt_Currency,Quantity,Account,Cost_Center,General_Ledger,Asset,
    WBSElement,Internal_Order,Company_Code'.
            CONDENSE v_line NO-GAPS.
            APPEND v_line TO it_final.
          ENDIF.
          CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
            EXPORTING
              i_field_seperator    = ','
            TABLES
              i_tab_sap_data       = it_csvacc
            CHANGING
              i_tab_converted_data = it_csvfile
            EXCEPTIONS
              conversion_failed    = 1
              OTHERS               = 2.
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          LOOP AT it_csvfile INTO v_line.
            APPEND v_line TO it_final.
            CLEAR v_line.
          ENDLOOP.
          PERFORM download_to_server TABLES it_final
                                     USING  file
                                            w_hdl.
    FTP_DISCONNECT : This function module is used to disconnect the
    connection between SAP and other system.
          CALL FUNCTION 'FTP_DISCONNECT'
            EXPORTING
              handle = w_hdl.
    RFC_CONNECTION_CLOSE : This function module is used to disconnect the
    RFC connection between SAP and other system.
          CALL FUNCTION 'RFC_CONNECTION_CLOSE'
            EXPORTING
              destination = rfc_destination
            EXCEPTIONS
              OTHERS      = 1.
        ENDIF.
      ENDIF.
    ENDFUNCTION.
    *&      Form  download_to_server
          text
         -->IT_FILE    text
         -->FILE       text
         -->HDL        text
    FORM download_to_server TABLES it_file
                            USING  file
                                   hdl.
      CONDENSE file NO-GAPS.
    FTP_R3_TO_SERVER : This function module is used to transfer the
    internal table data as a file to other system in the character mode.
      CALL FUNCTION 'FTP_R3_TO_SERVER'
        EXPORTING
          handle         = hdl
          fname          = file
          character_mode = 'X'
        TABLES
          text           = it_file
        EXCEPTIONS
          tcpip_error    = 1
          command_error  = 2
          data_error     = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    "download_to_server
    *&      Form  upload_from_server
          text
         -->IT_FILE    text
         -->FILE       text
         -->HDL        text
    FORM upload_from_server TABLES it_file
                            USING  file
                                   hdl.
      CONDENSE file NO-GAPS.
      CALL FUNCTION 'FTP_SERVER_TO_R3'
        EXPORTING
          handle         = hdl
          fname          = file
          character_mode = 'X'
        TABLES
          text           = it_file
        EXCEPTIONS
          tcpip_error    = 1
          command_error  = 2
          data_error     = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT it_file.
        REPLACE ALL OCCURRENCES OF '#' IN it_file WITH ''.
        MODIFY it_file.
      ENDLOOP.
    ENDFORM.                    "upload_from_server
    Thanks

  • FTP_Connect error

    Hello Everyone,
    I have been trying to get a solution (I already posted earlirer regarding same issue )  to connect to ftp using FTP_connect FM.  FTP server is a local and i am trying to fetch the files from that.
    I have tested the connection using rsftp002 program n everything is looking ok. But while using the the FM in the program it throws an error tht
    "user xyz has no access authorization for computer x-server" where in x-server is the FTP server name and xyz is user name to server. I have even encrypted the password of the ftp server and sending it inthe program.
    What might be the probelm. Can anyone explain
    Regards

    Hi Rahul,
    We had the same problem.  FTP works fine from command prompts but not from SAP.  The solution was to reduce the ftp password.
    Within ABAP there is some character translation for the password and it won't handle more than about 8 characters.
    Regards,

  • FTP_CONNECT: User ------- has no access authorization for computer -------.

    Hi, could anyone please help me resolve the following issue:
    When i run the code below, it comes back saying "could not connect to "host". When tried to run in debug or test the FM "ftp_connect" it says "user ..... has no access authorization for computer .....
    REPORT  ZALB_FTP_TEST.
    types: begin of t_ftp_data,
             line(132) type c,
           end of t_ftp_data.
    data: lv_ftp_user(64)                value 'branch'.     "change this
    data: lv_ftp_pwd(64)                 value 'careful'. "change this
    data: lv_ftp_host(50)                value '10.50.1.199'.     "change this
    data: lv_rfc_dest like rscat-rfcdest value 'SAPFTP'.
    data: lv_hdl    type i.
    data: lv_key    type i               value 26101957.
    data: lv_dstlen type i.
    data: lt_ftp_data type table of t_ftp_data.
    field-symbols: <ls_ftp_data> like line of lt_ftp_data.
    *describe field lv_ftp_pwd length lv_dstlen.
    lv_dstlen = strlen( lv_ftp_pwd ).
    call 'AB_RFC_X_SCRAMBLE_STRING'
      id 'SOURCE'      field lv_ftp_pwd
      id 'KEY'         field lv_key
      id 'SCR'         field 'X'
      id 'DESTINATION' field lv_ftp_pwd
      id 'DSTLEN'      field lv_dstlen.
    call function 'FTP_CONNECT'
      exporting
        user            = lv_ftp_user
        password        = lv_ftp_pwd
        host            = lv_ftp_host
        rfc_destination = lv_rfc_dest
      importing
        handle          = lv_hdl
      exceptions
        not_connected   = 1
        others          = 2.
    if sy-subrc ne 0.
      write:/ 'could not connect to', lv_ftp_host.
    else.
      write:/ 'connected successfully. session handle is', lv_hdl.
      call function 'FTP_CONNECT'
        exporting
          handle        = lv_hdl
          command       = 'dir'
        tables
          data          = lt_ftp_data
        exceptions
          tcpip_error   = 1
          command_error = 2
          data_error    = 3
          others        = 4.
      if sy-subrc ne 0.
        write:/ 'could not execute ftp command'.
      else.
        loop at lt_ftp_data assigning <ls_ftp_data>.
          write: / <ls_ftp_data>.
        endloop.
        call function 'FTP_DISCONNECT'
          exporting
            handle = lv_hdl
          exceptions
            others = 1.
        if sy-subrc ne 0.
          write:/ 'could not disconnect from ftp server'.
        else.
          write:/ 'disconnected from ftp server'.
        endif.
      endif.
    endif.
    Thanks in advance for the help.

    It doesn't work for me if I just maintain * entry.
    But it works after I maintained specific IP address into the table,
    ref notes:2072995 - User has no access authorization for computer
    Cause
    The message comes after the implementation of note '1605054 - Restriction in access to FTP Servers & usage of test reports' or upgrading to a
    support package that contains this note. This note was created to prevent malicious users from accessing remote FTP servers.
    Resolution
    1. Please ensure that all manual steps from note 1605054 are implemented in your system along with the code corrections
    2. Then please enter the allowed FTP servers into the table SAPFTP_SERVERS or enter ‘*’ to allow all FTP servers.

  • ERORR IN  FTP_CONNECT

    Hi,
    i am trying to use FTP_CONNECT to establisht he connection but its giving error Attempt to set up connection to failed.
    i am passing the scrambled paswd . Could you plz tell me what is the issue..
    step followed.
    1. p_user = 'ABCD'.
    l_pwd = 'mx12345'.
    c_dest = 'SAPFTP'.
    p_host = '1123.31.1.12'.
    l_slen = STRLEN( l_pwd ).
    CALL FUNCTION 'HTTP_SCRAMBLE'
    EXPORTING
    SOURCE = l_pwd
    sourcelen = l_slen
    key = c_key
    IMPORTING
    destination = l_pwd.
    CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
    user = p_user
    password = l_pwd
    host = p_host
    rfc_destination = c_dest
    IMPORTING
    handle = w_hdl
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'FTP_R3_TO_SERVER'
    EXPORTING
    handle = w_hdl
    fname = '
    mx-fs01\ftp\ABMCPL\Minacs'
    character_mode = 'X'
    TABLES
    text = it_outfile
    EXCEPTIONS
    tcpip_error = 1
    command_error = 2
    data_error = 3
    OTHERS = 4.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    RAISING invalid_output_file.
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
    EXPORTING
    handle = w_hdl.
    CALL FUNCTION 'RFC_CONNECTION_CLOSE'
    EXPORTING
    destination = c_dest
    EXCEPTIONS
    OTHERS = 1.

    Hi Praveen,
    I checked the the SAPFTP in SM 59 also tested the connection it is working fine but still when i execute the FTP_CONNECT it is not connecting. Is there anything else from programmming side to be added?
    Thanks

  • Gertting error msg 'no access authorization'  while using FM FTP_CONNECT

    HI All,
    I'm using FTP_CONNECT FM to connect to FTP server and i'm getting the message User has no access authorization for computer. When i try to connect from command prompt using the same ip address, user name and password ..i can connect successfully. From SAP i getting the no authorization message.
    Please let me know do we need to maintain the IP address of the FTP server in sap ?

    Hello,
    Check this programs how they are using the FM
    RSFTP002                               Execute FTP Command
    RSFTP003                               FTP put / get Test
    RSFTP004                               FTP Copy
    RSFTP006                               FTP command list
    RSFTP007                               Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
    RSFTP009                               Test FTP put with Verify
    RSIRCCON                               KPro: Test of data connections to memory repositories

  • FTP_CONNECT to Windows based server

    Hi Experts,
    I am using FM <b>'FTP_CONNECT'</b> to send a file from local pc to <b>Windows based server</b>.
    I am using the parameters: username, pwd, hostname, rfc destination (when I test the RFC destination SAPFTP in SM59, it connects OK)
    I connected to the HOSTNAME from <b>command prompt</b> and it connects OK with same parameters.
    But when we try to connect with FM <b>'FTP_CONNECT'</b>, it gives error:
    'User has no access authorization for computer HOSTNAME'.
    Please advise,
    Regards,
    FS

    Following is the code we have used and it is working without any problems..
    Password encryption
    data : v_password(20),
    v_key type i value 26101957,
    v_slen type i.
    --- ENCRYPT PASSWORD
    The password is entered by the user on the selection screen in the parameter p_pswd.
    clear v_password.
    set extended check off.
    v_password = p_pswd.
    translate v_password to lower case.
    v_slen = strlen( v_password ).
    call 'AB_RFC_X_SCRAMBLE_STRING'
    id 'SOURCE' field v_password
    id 'KEY' field v_key
    id 'SCR' field 'X'
    id 'DESTINATION' field v_password
    id 'DSTLEN' field v_slen.
    FTP Connect
    data v_hdl type i.
    call function 'FTP_CONNECT'
    exporting
    user = p_usrid (User id used to connect)
    password = v_password
    host = p_ip_add (IP of the server to be connected)
    rfc_destination = p_sapftp (value is normally SAPFTP or SAPFTPA)
    importing
    handle = v_hdl
    exceptions
    not_connected = 1
    others = 2.
    From your msg it looks that the FTP connection is not the problem.. The problem is with the permissions for the user, with which you are doing the ftp, has..
    This user does not have write permissions in the directory in which it is trying to write the file..
    Try doing the FTP manually.. If this works then the FTP Command u r using after the FTP Connect should also work..

  • Ftp_connect/ running at background job

    Hi,
    When I try to run the FTP_CONNECT FM in background,
    the ftp server is not connected throwing an error message ''Attempt to set up connection to <ftpserver> failed''.
    I am using the RFC destination SAPFTPA and still it is not working!
    My program was successfully executing in fore ground with SAPFTP.
    Please help.
    Thanks and Regards,
    Kumar

    Have you gone through the following ?  You have asked the Same again ................
    Error in background job while running FTP_CONNECT
    Kanagaraja L
    Edited by: Kanagaraja  Lokanathan on Jun 30, 2009 7:17 PM

  • User ftpuser has no access authorization for computer(FTP_CONNECT)

    Hi Gurus
    i am getting error like this  "User ftpuser has no access authorization for computer" when i am trying to ftp_connect.i did use before this 'HTTP_SCRAMBLE' but still not getting output .i searched SDN its says answred but no solution.can anyone help me .

    It doesn't work for me if I just maintain * entry.
    But it works after I maintained specific IP address into the table,
    ref notes:2072995 - User has no access authorization for computer
    Cause
    The message comes after the implementation of note '1605054 - Restriction in access to FTP Servers & usage of test reports' or upgrading to a
    support package that contains this note. This note was created to prevent malicious users from accessing remote FTP servers.
    Resolution
    1. Please ensure that all manual steps from note 1605054 are implemented in your system along with the code corrections
    2. Then please enter the allowed FTP servers into the table SAPFTP_SERVERS or enter ‘*’ to allow all FTP servers.

  • Ftp_connect with specific port

    Hi All,
    Any help using FTP_CONNECT function, Doing connection to ftp server with specifi port (not port 21) will be greatly appreciated. Any one?
    thanks
    supriatna

    Hi Supriatna,
    sample code may be useful to you:
    FTP Connect
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          USER                   = P_USER
          PASSWORD               = P_PWD
          ACCOUNT                =
          HOST                   = P_HOST
          RFC_DESTINATION        = 'SAPFTPA'
          GATEWAY_USER           =
          GATEWAY_PASSWORD       =
          GATEWAY_HOST           =
        IMPORTING
          HANDLE                 = HDL
        EXCEPTIONS
          NOT_CONNECTED          = 1
          OTHERS                 = 2.
    If sy-subrc = 0.
            CALL FUNCTION 'FTP_COMMAND'
                 EXPORTING
                      HANDLE        = HDL
                      COMMAND       = V_PATH
                 TABLES
                      DATA          = IT_RESULT
                 EXCEPTIONS
                      TCPIP_ERROR   = 1
                      COMMAND_ERROR = 2
                      DATA_ERROR    = 3
                      OTHERS        = 4.
    Endif.
    Lanka

  • FTP_CONNECT failed for SAPFTP from WD4A to external Server

    Hi experts,
    this is a challange to you.
    He do have a WD4A application runnig on a BI with  SAP NetWeaver 2004s and a SAP BASIS 700 Level 21 highest Support package SAPKB70021.
    The application runs well and only some strange behaviors in CZ and HU we have obtained. But this is not the Question i will ask:
    For an excel template download we will use at an external MS Server2003. We want to sent the data string which has to
    be displayed in excel via FTP to this server (The server will convert the data string with makros and send it back zu WD4A).
    So far so good. But every time we tried to open the connection with FTP_CONNECT we the communication failed.
    What do we do exactly?
    1. Event through Button
    1. Creating the data string on Eventhandler method (View)
    2. using a Function Call from Eventhandler to start the file transfer.
    3. Parameters are user, pwd, host, destination ...
    4. with HTML_SCAMBLE hint pwd
    5. call function 'FTP_CONNECT'
    The connection failed.
    WE DO CALL the Function correct, cause testing FTP_CONNECT with Program RSFTP002 the connection works.
    IF we start the Function Call we use inside the WD4A outside the WD4A, the connection works.
    We do have an ITS Service which works on this Server. An RFC CALL to the ERP R/3 with the same Function Call fails also as the Call in BI.
    Does anyone know, if  there are technical limits to WD4A to use the connections to an external server via SAPFTP ? It is forbidden to mount the file system of the server directly on the SAP BI System.
    Our Basis and Network guys would not find anything.
    At least: WE do use an Excel download with templates without using the MS Server. Therefore we have problems with different MS Office Versions, Language and date display. Thats why we want to go the way above.
    lot of greetings
    Thorsten

    Hi,
    where exactly is the FM crashing and why? Did you debug? Is it occuring at
    CALL FUNCTION 'FTP_CONNECT' DESTINATION RFC_DESTINATION
         EXPORTING USER = USER PWD = PASSWORD ACCT = ACCOUNT HOST = HOST
                   TRACE = FTP_TRACE GUSER = GATEWAY_USER
                   GPWD = GATEWAY_PASSWORD GHOST = GATEWAY_HOST
         IMPORTING HANDLE = HANDLE ERROR = CERROR
         EXCEPTIONS SYSTEM_FAILURE = 1 COMMUNICATION_FAILURE = 2.
    or earlier?
    Try tracing with ST01, one time with the way it works, and another time out of the WebDynpro where it crashes, then compare the logs.
    regards, Lukas

  • To use ftp_connect to connect to our local system

    hii
    can anybody plz tell me how to connect to our local system using function module
    ftp_connect
    plz specify all the necessary parameters such as user, password and so on.
    thanx in anticipation
    answers will be rewarded

    Hi,
    Please find the sample program for your requirement.
    report rsftp020 message-id zz.                                                                               
    parameters: user(12) type c lower case,                                       
                pwd(20) type c lower case,                                        
                host(64) type c lower case,                                       
                cmd1(100) type c lower case.                                                                               
    data: hdl type i,                                                             
          key type i value 26101957,                                              
          dstlen type i.                                                                               
    data: begin of result occurs 0,                                               
          line(100) type c,                                                       
          end of result.                                                                               
    authority-check object 'S_PATH'                                               
      id  'FS_BRGRU' dummy                                                        
      id  'ACTVT'    field '02'.                                                  
    if sy-subrc ne 0.                                                           
    message e000 with 'You are not authorized to run program: ' sy-repid.       
    endif.                                                                               
    describe field pwd length dstlen.                                                                               
    call 'AB_RFC_X_SCRAMBLE_STRING'                                             
      id 'SOURCE'      field pwd    id 'KEY'         field key                  
      id 'SCR'         field 'X'    id 'DESTINATION' field pwd                  
      id 'DSTLEN'      field dstlen.                                                                               
    call function 'FTP_CONNECT'                                                 
         exporting user = user password = pwd host = host                       
         rfc_destination = 'SAPFTPA'                                            
         importing handle = hdl.                                                                               
    if cmd1 ne ' '.                                                
      call function 'FTP_COMMAND'                                  
           exporting handle = hdl command = cmd1                   
           tables data = result                                    
           exceptions command_error = 1 tcpip_error = 2.           
      loop at result.                                              
       write at / result-line.                                     
      endloop.                                                     
      refresh result.                                              
    endif.
    call function 'FTP_DISCONNECT'       
         exporting handle = hdl.         
    thanks,
    sksingh

  • FTP_connect with a proxy server

    Hi,
    I'm trying to connect to an external ftp-server via a proxy FTP-server using function ftp_connect.
    I'm using the gateway parameters to connect to the proxy, but the function always returns an error saying that the user doesn't have access to the external FTP-server. I know the users and passwords are correct. Is it the correct way to use the gateway parameters? What is the account parameter for?
    Thanks,
    Wim

    Hello François,
    I'm trying to access an FTP Server via a proxy server as well - but it doesn't seem to work.
    I can connect to that FTP Server via the same proxy with FileZialla so I know the users and PWDs are working.
    How can I provide the proxy information (host, user and PWD) within the RFC connection - or what do you mean by destination?
    The FTP trace (run program RSFTP001) gives the following result:
    trc file: "dev_ftp", trc level: 2, release: "700"
    Tue Sep 27 10:37:26 2011
    [7299248] sccsid:@(#) $Id: //bas/700_REL/src/krn/ftp/ftpmain.c#17 $ SAP
    @(#) $Id: //bas/700_REL/src/krn/ftp/ftp.c#4 $ SAP
    @(#) $Id: //bas/700_REL/src/krn/ftp/ftpcmd.c#4 $ SAP
    sapftp.ini file path : /usr/sap/D2E/DVEBMGS10/exe/sapftp.ini
    SAPFTP Passive mode set to = 0
    [7299248] FTP Start : argc - 6 a0 - /usr/sap/D2E/DVEBMGS10/exe/sapftp
    g56e sapgw10 74691815 CPIC_TRACE=2 IDX=1
    [7299248] RFC Version 700
    [7299248] Install server functions
    [7299248] Call RfcAccept
    [7299248] Enter RfcDispatch loop
    [7299248] Partner codepage 4102
    [7299248] connect request host : ftp.host.com , user : FTPUser
    [7299248] gateway host : proxy.lan.net , user : ProxyUser
    [7299248] Connected to proxy.lan.net Port 21.
    - NI handle: 1
    [7299248] FTP server : 220 Proxy FTP Service
    [7299248]    > USER ProxyUser
    [7299248] FTP server : 331 Enter password.
    [7299248]    > *****
    [7299248] FTP server : 530-User Access denied.
    530-
    530-Usage: USER username@proxyusername@hostname
    530        PASS password@proxypassword
    [7299248] FTP disconnect - NI handle : 1
    [7299248]    > QUIT
    [7299248] FTP server : 221 Service closing control connection.
    [7299248] FTP Stop
    In my coding I scrambled both PWDs with FM 'HTTP_SCRAMBLE' using key '26101957'.
    I tried as well setting the parameter user to  (using the scrambeld PWDs) but this gives the same resulst.
    Here's a part of my code
    REPORT  zz_test_ftp.
    PARAMETERS: user(50) TYPE c LOWER CASE,
                pwd(60) TYPE c LOWER CASE,
                host(64) TYPE c LOWER CASE,
                gw_user(30) TYPE c LOWER CASE,
                gw_pwd(30) TYPE c LOWER CASE,
                gw_host(30) TYPE c LOWER CASE,
                cmd1(80) TYPE c LOWER CASE,
                cmd2(80) TYPE c LOWER CASE,
                cmd3(80) TYPE c LOWER CASE,
                dest LIKE rfcdes-rfcdest DEFAULT 'SAPFTPA',
                compress TYPE c DEFAULT 'N'.
    DATA: hdl TYPE i,
          key TYPE i VALUE 26101957,
          slen TYPE i.
    DATA: BEGIN OF result OCCURS 0,
          line(100) TYPE c,
          END OF result.
    SET EXTENDED CHECK OFF.
    slen = STRLEN( pwd ).
    CALL FUNCTION 'HTTP_SCRAMBLE'
      EXPORTING
        SOURCE      = pwd
        sourcelen   = slen
        key         = key
      IMPORTING
        destination = pwd.
    slen = STRLEN( gw_pwd ).
    CALL FUNCTION 'HTTP_SCRAMBLE'
      EXPORTING
        SOURCE      = gw_pwd
        sourcelen   = slen
        key         = key
      IMPORTING
        destination = gw_pwd.
    "concatenate user '@' gw_user '@' host into USER.
    "concatenate pwd '@' gw_pwd into PWD.
    CALL FUNCTION 'FTP_CONNECT'
      EXPORTING
        user             = user
        password         = pwd
        account          = user
        host             = host
        rfc_destination  = dest
        gateway_user     = gw_user
        gateway_password = gw_pwd
        gateway_host     = gw_host
      IMPORTING
        handle           = hdl.

Maybe you are looking for

  • Itunes won't open. continual error message

    Itunes 8 won't open. I click to try to open it and I get "itunes has encountered a problem and needs to close." I've tried plugging in Ipod to see if it will help in opening itunes. it won't. I've uninstalled and reinstalled. I've tried taking itunes

  • No Actions on my Extensions preferences

    A few bugs in Yosemite after just 2 day of release. For example, I don't have actions on my mac Extensions preferences. You need to activate Mark up on your Sistem preferences -> Extensions -> Actions But I have no Actions! Is it just me?

  • Camera RAW Crashing CS5 when opening MarkII Raw file

    Hoping someone can help me figure out why 1 out of 5 times I open a 5dMarkII RAW File(s) CS5 crashes?  Running a MAC Pro Tower, 2.8ghz Quad-Core intel xeon, 7 gb 1066 mhz ddr3, OSx10.6.7, CS5 v12 x64.  I have 4 internal drives installed:  1tb system

  • Master Collection suite 6

    J'ai un problème avec l'installation de Creative Suite 6 Master Collection. C'est l'installation à partir de DVD, c'est un upgrade à partir d'une version 5.5. Je place le premier DVD, le programme d'installation me demande le numéro de série, ce que

  • Won't boot with imac rest disc

    I am trying to do a fresh install as i have just donated by imac to my mums school, i load the disc, follow the instructions when asked to restart. after clicking the button imac switches off then won't restart. I go past the initial light grey scree