How to transfer itab to using FTP...

Hello Experts,
How do I transfer the contents of my itab to a given FTP location? I was asked to provide in
my selection screen the ff:
1. the path on where to save the file
2. the IP address
3. the host username
4. the host password
Can you please provide steps on how to do this based from the critera above. Hope you can help me guys.Thank you and take care!

Hi,
Below program will create a file on the specified FTP server by taking the data from the internal table.
Replace 'XXX.XXX.XX.XXX' with your host name.
Check the below code.
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 ‘|’(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 ‘|’(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.

Similar Messages

  • I am anew user. Initially I created several folders for my photos but now know how to transfer photo folders using iTunes. However I am unable to delete/remove the now empty folders I created in iPad.

    I am anew user.
    Initially I created several folders for my photos on the iPad itself but now know how to transfer photo folders using iTunes. However I am unable to delete/remove the now empty folders I created in iPad.
    Can anyone assist me please
    Thanks

    When you are in Album view in the Photos app - tap the edit button in the upper right corner - tap the X in the corner of the album to delete it.

  • How to transfer excel files(on ftp server) into internal table?

    hello,everyone
    pls tell me how to transfer excel files those on a ftp server into internal table?
    ps.i know the function 'ftp_server_to_r3',it can help to transfer flat file.

    Hi,
    I believe you want to get the data from the FTP Server to R3.
    I am also sending the code. Have a look and it would help you.
    First get the Password and user name and the FTP Server Path where file is stored and FTP Server Host name
    FUNCTION zfi_ftp_get.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(I_FILENAME) TYPE  C
    *"  TABLES
    *"      T_BLOB STRUCTURE  ZFI_TLM_LENGTH OPTIONAL " is a table type with a field called line of length 992
    *"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
      DATA : i_password(30)     TYPE c,
             i_user(30)         TYPE c,
             i_host(30)         TYPE c,
             i_rfc_destination  TYPE rfcdes-rfcdest,
             i_length           TYPE i,
             i_folder_path(100) TYPE c.
      DATA:   lv_blob_length   TYPE i.
      DATA:   lv_length        TYPE i,  "Password length
              lv_key           TYPE i VALUE 26101957,
              lv_password(30)  TYPE c,
              lv_ftp_handle    TYPE i,
              lv_cmd(80)       TYPE c.
      DATA: BEGIN OF result OCCURS 0,
            line(100) TYPE c,
            END OF result.
      TYPES: BEGIN OF ty_dummy,
             line(392) TYPE c,
           END   OF ty_dummy.
      DATA: lt_dummy TYPE TABLE OF ty_dummy,
            ls_dummy LIKE LINE  OF lt_dummy.
      i_password        = 'vnhdh'.
      i_user            = 'sdkgd'.
      i_host            = 'sbnksbg'.
      i_rfc_destination = 'SAPFTP'.
      i_length          = '992'.
      i_folder_path     = '/hioj/hohjk/hh'.
      lv_length = STRLEN( i_password ).
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = i_password
          sourcelen   = lv_length
          key         = lv_key
        IMPORTING
          destination = lv_password.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user            = i_user
          password        = lv_password
          host            = i_host
          rfc_destination = i_rfc_destination
        IMPORTING
          handle          = lv_ftp_handle
        EXCEPTIONS
          not_connected   = 1
          OTHERS          = 2.
      IF sy-subrc = 1.
        return-type = 'E' .
        return-message = 'FTP Connection not Successful'.
        APPEND return.
      ELSEIF sy-subrc = 2.
        return-type = 'E' .
        return-message = 'FTP Connection not Successful'.
        APPEND return.
      ELSEIF sy-subrc EQ 0.
        return-type = 'S' .
        return-message = 'FTP Connection Successful'.
        APPEND return.
        CONCATENATE 'cd' i_folder_path INTO lv_cmd SEPARATED BY space.
        CALL FUNCTION 'FTP_COMMAND'
          EXPORTING
            handle        = lv_ftp_handle
            command       = lv_cmd
          TABLES
            data          = result
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        IF sy-subrc = 1.
          return-type = 'E' .
          return-message = 'Command Error Occured during open of FTP Folder'.
          APPEND return.
        ELSEIF sy-subrc = 2.
          return-type = 'E' .
          return-message = 'TCIP Error Occured during open of FTP Folder'.
          APPEND return.
        ELSE.
          REFRESH t_blob.
          lv_blob_length = 992.
          TRANSLATE i_filename TO LOWER CASE.
          CALL FUNCTION 'FTP_SERVER_TO_R3'
            EXPORTING
              handle      = lv_ftp_handle
              fname       = i_filename         
            IMPORTING
              blob_length = lv_blob_length
            TABLES
              blob        = lt_dummy.
          t_blob[] = lt_dummy[].
        ENDIF.
      ENDIF.
    ENDFUNCTION.
    Regards
    Sajid
    Edited by: shaik sajid on Nov 16, 2010 7:25 AM

  • How to transfer an image using xml

    how to transfer live video from mobile to an http server(using web services).............

    Not that familiar with the Mac OS, but you need a non-destructive partition editor to resize the partition (rather than 'moving' the partition from 80GB to 500GB).
    iPartition should do the job (but it's 35GBP) from Coriolis Systems (http://www.coriolis-systems.com/iPartition.php).
    Alternatively, you will be able to do this from the Command Line without buying any software - this page gives a fair guide: http://www.macworld.com/article/55274/2007/02/marchgeekfactor.html

  • How to upload a file using FTP tin JSP

    Hello friends ,
    I m actually looking to upload a file using FTP to a server(webserver) in JSP . If there any tags available to accomplish this r any information regading this plzz let me no.
    Thanks in advance
    P.Satish

    Not sure exactly what you're trying to do but you set the content type a stream it to the browser from a servlet

  • How to transfer tabl content using ALE

    Hi All
    I need to to transfer the content of a HR table (T526) using an ALE scenario. However I have not found a way to do this. I stumpled over CONDA2 but not quite sure if this suits the bill. Anybody out there who can help.
    I am not an HR wiz so bear with me if this is dead obvious.
    Hope somebody can help
    Cheers

    Hello Bowie,
    Could you please help in how to use CONDA2 message type in ditributing HR Configuration data like data from following tables..
    T001P     Personnel Area/Subarea
    T500P     Personnel Areas
    T503     Employee Group/Subgroup
    T511     Wage Types
    T512T     Wage Type Texts
    T512Z     Permissibility of Wage Types per Infotype
    T528B     Positions
    T554S     Attendance and Absence Types
    T554T     Attendance and Absence Texts
    Thaks,
    Venkat

  • How to transfer multimedia file using JMF/RTP through Bluetooth

    Hi,
    I am trying to stream a multimedia file via bluetooth but I don't know how to wrap RTP into bluetooth connection.
    I also tried to cut the multimedia file in small pieces but they can't be read by the player.
    How can I stream a multimedia file via Bluetooth using JMF ??
    Regards,
    Danix

    -danix- wrote:
    Hi,
    I am trying to stream a multimedia file via bluetooth but I don't know how to wrap RTP into bluetooth connection.I know absolutely nothing about Bluetooth networking, but I assume you don't wrap protocols into connections with it...
    How can I stream a multimedia file via Bluetooth using JMF ??You'd need to write a custom RTPConnector that would transmit the RTP packets over a Bluetooth connection rather than the standard UDP socket...
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/RTPConnector.html]
    There's some code to get you started. You'll need to update the SockOutputStream & SockOutputStream classes of the RTPConnector to read/write to a Bluetooth connection rather than a UDP socket.
    Good luck.

  • How to transfer encrypted file using B2B sftp with custom doc over generic

    hi ,
    we have a requirement to get and send an encrypted file to/from our trading partner.
    Previously we configured B2B sftp with custom doc. over generic exchange protocol to get a text file and used 1st 11 charecters in the file as identifier for the TPA configuration and successfully processed the file. Since we are getting an encrypted file , we need to find a way to identify the TPA config. .
    Please reply to this thread if you have any suggestions. Pls. feel free to ask if you need more information to understand the situation.
    thanks
    srini

    hi Ramesh,
    I have sent mail to you . We are actually using file name convensions but we are using internal delivery as B2B InQuueue . And when we use custom document over generic exchange , in the paramenters we do not see any file name property. i hava also sent you the TPA so that you can get idea of the configuration we did.
    thanks
    Srini

  • How to use secure FTP using FTP adapter in PI

    Hi,
    PI does not give SFTP adapter, for using the SFTP adapter we need some security certificates + we need to purchase the
    SFTP adapter.
    How to achive SFTP functionality using FTP adapter? We need to do some script coding.
    Pl throw some light on this.
    Thanks,
    Krishna

    HI Krishna,
    Ref:  http://weblogs.sdn.sap.com/cs/blank/view/wlg/22415
    http://weblogs.sdn.sap.com/cs/blank/view/wlg/22776
    http://aedaptive.com/index.php/solutions/pgp-for-sap-netweaver
    Thanks,

  • Processing files in Sequence using FTP Adapter

    Hi Experts,
    I have searched several forums but i am not clear on  how to process the files using FTP Adapter based on Timestamp.
    To process the files in sequence i.e, FIFO using FTP Adapter
    i have the files with file name customer and timestamp :  customer<yyyyMMddHHmmss>
    there are around 50 files in the FTP server llike this.
    I need to process these files acording to the timestamp and place the files in same processing sequence in the receiver end using the file adapter.
    If i specify the parametes in sender FTP Adapter as
    Qos= EOIO
    Queue name = ACCOUNT
    Whether these parameters would do the processing in sequence according to the Timestamp?
    Suppose if the queue ID for Inbound(SMQ2) is XBTI0_ACCOUNT then whether it will be the same for Outbound(SMQ1)?
    Kindly suggest me how to process the files in sequence according to the Timestamp using FTP Adapter
    Please reply..
    Thanks
    Sai

    Hi Shabarish,
    But this would require one more additional channel to process
    So i think it will take more time to process.
    Let me clarify my question once again.
    I need to Pick the files from FTP server based on their TimeStamp and in sequence.
    the file names are like this Customer<YYYYMMDDHHmmSS>.
    suppose i have 3 files as
    Customer20050413044534
    Customer20050414053430
    Customer20050315034533
    So i need to pick these files in this order and place the files in the same order to the receiver end(File Adapter)
    Customer20050315034533
    Customer20050413044534
    Customer20050414053430.
    As i am using FTP sender adapter i cannot use processing sequence "By Date".
    please suggest me on this.
    Thanks
    Sai.

  • How to send multiple files in parallel using ftp with single connection

    Hi.
    i have written code for file upload manager using ftp..
    it perfectly working with sequence file uploading in single connection..
    And i tried to upload multiple files with parallel processing in a single connection.... but it is not working properly.. i also used thread concept
    but single file only transfered and connection refused...
    my code here...
    //////////////////// main class //////////////////////////////////////////
    ftp.connect();
    ftp.login();
    String [] archivos = new  String[100];
                                      File dir = new File("C:\\Files Uploading\\");
                                       archivos = dir.list();
                                       for (int s=0; s<archivos.length;s++)
         //Start Data Transfer Here
         new DataTransfer(archivos[s]).start();
                                       Thread.sleep(1000);
    /////////////////////// thread class ////////////////////////////////
    class DataTransfer extends Thread
          String FileName="";
          String LocalPath="",RemotePath="";
           public DataTransfer(String fname)
         FileName = fname;
         LocalPath = "C:\\Files Uploading\\" + FileName;
         RemotePath = FileName;
         System.out.println(LocalPath);          
            public void run()
                        System.out.println("DataTransfer Started");
         /File Transfer Here
         try
               FileInputStream input = new FileInputStream(LocalPath);
                               Ftp_Client.storeFile(RemotePath,input);
         System.out.println("Successfully sent : " + RemotePath);
         catch (Exception exc)
              System.out.println(exc.getMessage());
              System.out.println("DataTransfer Ended");
         }otherwise tell me any other alternate way

    And i tried to upload multiple files with
    parallel processing in a single connection....
    but it is not working properly.FTP isn't a multiplexing protocol. How could it work at all?

  • Transfer a xml file from application server to another server using FTP

    Hi experts,
    I am stuck in this situtaion.
    My interface generates a xml file on an application server.
    Now i need to read the xml file generated and transfer it to another system using FTP.
    I can use READ DATASET to read the file from the application server.
    And use the below function modules to transfer it to another system
         HTTP_SCRAMBLE.
         FTP_CONNECT
         CONCATENATE 'put' src_file_dest into variable.
         FTP_COMMAND with command = variable.
         FTP_DISCONNECT.
    Now my question is:
       - Is it correct????
       - I am getting an cerror = 3 while using FTP_CONNECT. is it an authorization issue???
         if yes, what is the issue???
       - How to connect the file read from READ DATASET to the FTP Function Modules ????
    Thanks and Regards
    Gaurav Raghav

    Try the following set of FTP commands..
    This code gets the file (NOT the content) from the server and sends it to the FTP.
    *********start send file to FTP********************
    * FTP commands : 1. ascii
    *       2. cd
    *       3. lcd
    *       4. put
    call function 'HTTP_SCRAMBLE'
        exporting
          source      = x_pwd
          sourcelen   = dstlen
          key         = key
        importing
          destination = destin.
      clear pass.
      pass = destin.
      call function 'FTP_CONNECT'
           exporting
                user            = x_user
    *            PASSWORD       = X_PWD
                password        = pass
                host            = x_host
                rfc_destination = x_dest
           importing
                handle          = hdl.
    *  COMMAND ascii -->
      refresh : x_result.
      call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd_ascii
          compress      = compress
        tables
          data          = x_result
        exceptions
          command_error = 1
          tcpip_error   = 2.
    *command cd SAP\ -->
      split x_file at '\' into dummy ftp_file.
      concatenate x_cmd1 dummy into dummy2 separated by space.
      concatenate dummy2 '\' into cmd_cd.
      refresh : x_result.
      call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd_cd
          compress      = compress
        tables
          data          = x_result
        exceptions
          command_error = 1
          tcpip_error   = 2.
    constants: winslash(1)   value  '\',
                unixslash(1)  value  '/'.
    call 'C_SAPGPARAM' id 'NAME'  field 'DIR_HOME'
                         id 'VALUE' field  tempdir.
    * command lcd SERVER\usr\....\DIR_HOME --?
    concatenate 'lcd' tempdir into cmd_lcd separated by space.
    refresh : x_result.
    call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd_lcd
          compress      = compress
        tables
          data          = x_result
        exceptions
          command_error = 1
          tcpip_error   = 2.
    * COMMAND put file -->
    concatenate 'put' ftp_file into cmd_put separated by space.
    refresh : x_result.
      call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd_put
          compress      = compress
        tables
          data          = x_result
        exceptions
          command_error = 1
          tcpip_error   = 2.
    * command ls -->
      refresh : x_result.
      call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd2
          compress      = compress
        tables
          data          = x_result
        exceptions
          command_error = 1
          tcpip_error   = 2.
      call function 'FTP_DISCONNECT'
        exporting
          handle = hdl.
    ******* end send file to FTP*****
    Edited by: Iria Koutsogianni on Jan 19, 2009 11:50 AM

  • Me and my partner are currently using the same apple id and have no space left on our devices. We are currently waiting on the iphone 6 plus to arrive and don't know how to transfer all data to the new phones.

    Me and my partner are currently using the same apple id and have no space left on our devices. We are currently waiting on the iphone 6 plus to arrive and don't know how to transfer all data to the new phones.?

    I don't know if I'm asking this all in a way that can be understood? Thanks ED3K, however that part I do understand (in the link you provided!)
    What I need to know is "how" I can separate or rather create another Apple ID for my son-who is currently using "my Apple ID?" If there is a way to let him keep "all" his info on his phone (eg-contacts, music, app's, etc.) without doing a "reset?') Somehow I need to go into his phone's setting-create a new Apple ID and possibly a new password so he can still use our combined iCloud & Itunes account?
    Also then letting me take back my Apple ID & password, but again allowing us (my son and I) to use the same iCloud & Itunes account? Does that make more sense??? I'm sincerely trying to get this cleared up once and for all----just need guidance from someone who has a true understanding of the whole Apple iCloud/Itunes system!
    Thanks again for "anyone" that can help me!!!

  • How to transfer songs from one iPad to another iPad using iTunes?

    How to transfer songs from one iPad to another iPad using iTunes?

    You can't without a third party app. If you didn't purchase the Music with your Apple ID or if the music was imported from CD's on your friends iTunes library, syncing will not work ....nor will transferring purchases.
    Look at this app .... TouchCopy
    http://www.wideanglesoftware.com/touchcopy/index.php

  • How can I create a directory on my server using FTP in applescript?

    Hi
    I have created a script which successfully uploads files to my server using FTP and a curl command.
    The one thing I haven't worked out how to do is how to create a directory on my server using applescript. At the moment I have to manually create the correct directory for the script to work, but would like to be able to automate everything.
    Would this be possible?
    Thanks
    Nick

    Thanks Bernard.
    I have tried that and still get the error message:
    "curl: Can't open '--ftp-create-dirs'!
    curl: try 'curl --help' or 'curl --manual' for more information
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
    curl: (9) Server denied you to change to the given directory"
    The other relevant parts of the script are:
    set ftp_url to "ftp.****.org.uk/artists/" & artistName2 & "/assets/"
    set ftp_username to "*****@*****.org.uk"
    set ftp_password to "****"
    set ftp_entire to ftp_username & ":" & ftp_password & " ftp://" & ftp_url
    set outPath to outputFolder & fileCounter & ".jpg"
    and then...
    do shell script ("curl -T --ftp-create-dirs " & outPath & " -u " & ftp_entire)
    Like I said, all works fine when the directories are already in place. I have permissions for the artists folder set to "777", i.e. writable. Because the script is trying to create two directories at once, i.e. "artistName2" and then "assets" under it, I wondered if this was significant, but then I tried with just one new directory, and still got the error.

Maybe you are looking for

  • I'm trying to have existing Exchange accounts setup on my new iMac and can't get it to work.

    I have existing Exchange accounts setup on my iPhone and iPad to access my work email.  I'm trying to do the same on my new iMac and can't get it to work.  I have it setup the same as my iPad and it asks me for my password over and over...any suggest

  • Help! Safari and trojan? How do I identify and get rid of it?

    Please help me understand and get rid of this-your expertise sincerly appreciated! I posted about this problem a couple of weeks ago, but got no response. I seem to have a trojan attached to Safari (my analysis). It delays or stops loading of all pag

  • Classloader In Ejb

    "Imagine we're using this class from a WAR, but that this class is also used within an EJB Jar in the same EAR. This class will have been loaded by the EJB class loader, and will be unable to load classes within the WAR. The solution is to provide th

  • Error MSG"Not Allowed"?

    My iPhone 4s says latest update is IOS 7.1.2 How do I update to IOS 8?

  • X2-00 echo Problem

    I recently got the X2-00 and callers complain that they hear themselves (like an echo) and that is very distracting. I tried to lower the volume - that didnt help. If I switch to loudspeakers then there is no echo (maybe there is a compensation activ