How to copy a file from application server to local system

Guys,
Need to copy a file from application server to local system.Is there an FM for the same.
Tried searching for it but couldn't find anything useful.
Code snippets will be highly appreciated.
Warm Regards,
P.
Moderator message: very frequently asked and answered question, obviously you did not search thoroughly, all points removed.
Edited by: Thomas Zloch on Dec 3, 2010 4:48 PM

hi,
You can use the transactions CG3Y or through program u can do like this..
DATA: BEGIN OF IT_FILE OCCURS 0,
                LINE TYPE STRING,
           END OF IT_FILE.
OPEN DATASET <file_name>  FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF SY-SUBRC IS INITIAL.
          DO.
            READ DATASET<file_name> INTO IT_FILE-LINE.
            IF SY-SUBRC = 0.
              APPEND IT_FILE.
              CLEAR IT_FILE.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
CLOSE DATASET <file_name>.
Download it to local system using  FM - GUI_DOWNLOAD

Similar Messages

  • How to upload XML file from Application server.

    Hi,
    How to upload XML file from Application server.Please tell me as early as possible.
    Regards,
    Sagar.

    Hi,
    parameters : p_file type ibipparms-path obligatory.
    ***DOWNLOAD---->SAP INTO EXCEL
    filename1 = p_file.
    call function 'GUI_DOWNLOAD'
      exporting
      BIN_FILESIZE                    =
        filename                        = filename1
        filetype                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      tables
        data_tab                        = it_stock
      FIELDNAMES                      =
    exceptions
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       others                          = 22
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regards,
    Deepthi.

  • How to delete a file from application server?

    Hi gurus,
    i want delete a file from application server . can any one tell me the BAPI/Fm .
    thanks in advance

    See the replies of the thread;
    How to delete  File from the Application Server,ABAP
    But i can smell something fishy in both  The specified item was not found. and The specified item was not found. style of posting questions. Also both of you have similar questions in your profile....
    Hmmm, Mods have to take care of the Rest...
    Regards
    Karthik D

  • How to download a file from application server to presentation server

    Hi experts,
    I want to download a file from application server to presentaion server, file contaims three fields customer name, customer email id and status..
    help me out i m new into sap.

    Dear Aditya,
    Please check below thread
    http://scn.sap.com/thread/1010164
    it will help you.
    BR
    Atul

  • How to display a file from Application server without downloading it to local drive

    I want to dispaly a file from Application server without downloading it to my local system.
    i tried the below method but it didn't work.
         CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
          EXPORTING
            APPLICATION            = L_FILE
            DEFAULT_DIRECTORY      = L_DIR

    Hi,
    Use open dataset to read file from application server.
    try like this sample code:
    data : p_file like ibipparms-path.
    data : rec(350) type c.
    data:  g_delimiter(1) type c value ','.
    maintain the file path in p_file. then
    open dataset p_file for input in text mode encoding default.
       IF SY-SUBRC = 0.
    do n times.
    READ dataset p_file into rec.
    split rec at g_delimiter into your internal table fields like it-id it-name it-age.
    append it.
    clear it.
    enddo.
    close dataset p_file.
    Now you have the data in internal table it.

  • How to upload .CSV file from Application Server

    Hi Experts,
        How to upload .CSV file separated by ',' from Application server to an internal table.
    Invoice No,Cust No,Item Type,Invoice Date,days,Discount Amount,Gross Amount,Sales Amount,Customer Order No.,Group,Pay Terms
    546162,3233,1,9/4/2007,11,26.79,5358.75,5358.75,11264,HRS,11
    546163,2645,1,9/4/2007,11,3.07,305.25,305.25,10781,C,11
    Actually I read some already answered posts. But still I have some doubts.
    Can anybody please send me the code.
    Thanks in Advance.

    Hi Priya,
    Check this code
    Yhe logic used here is as follows,
    Get all the data into an internal table in the simple format ie: a row with one field contains an entire line
    After getting the data, we split each line of the table on every occurrence of the delimiter (comma in your case)
    Here, I have named the fields as field01, field02 etc, you could use your own names according to your requirement
    parameters: p_file(512).
      DATA : BEGIN OF ITAB OCCURS 0,
              COL1(1024) TYPE C,
             END OF ITAB,
             WA_ITAB LIKE LINE OF ITAB.
      DATA: BEGIN OF ITAB_2 OCCURS 0,
        FIELD01(256),
        FIELD02(256),
        FIELD03(256),
        FIELD04(256),
        FIELD05(256),
        FIELD06(256),
        FIELD07(256),
        FIELD08(256),
        FIELD09(256),
        FIELD10(256),
        FIELD11(256),
        FIELD12(256),
        FIELD13(256),
        FIELD14(256),
        FIELD15(256),
        FIELD16(256),
       END OF ITAB_2.
      DATA: WA_2 LIKE LINE OF ITAB_2.
        OPEN DATASET p_FILE FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
        IF SY-SUBRC = 8.
          WRITE:/ 'File' , p_FILE , 'cannot be opened'.
          LV_LEAVEPGM = 'X'.
          EXIT.
        ENDIF.
        WHILE SY-SUBRC <> 4.
          READ DATASET p_FILE INTO WA_ITAB.
          APPEND WA_ITAB TO ITAB.
        ENDWHILE.
        CLOSE DATASET p_FILE.
      LOOP AT ITAB INTO WA_ITAB.
        SPLIT WA_ITAB-COL1 AT ','    " where comma is ur demiliter
         INTO WA_2-FIELD01 WA_2-FIELD02 WA_2-FIELD03 WA_2-FIELD04
         WA_2-FIELD05 WA_2-FIELD06 WA_2-FIELD07 WA_2-FIELD08 WA_2-FIELD09
         WA_2-FIELD10 WA_2-FIELD11 WA_2-FIELD12 WA_2-FIELD13 WA_2-FIELD14
         WA_2-FIELD15 WA_2-FIELD16.
        APPEND WA_2 TO ITAB_2.
        CLEAR WA_2.
      ENDLOOP.
    Message was edited by:
            Kris Donald

  • How to upload a file from application server?

    Hi experts,
    I am going to create a conversion program using call function 'HR_INFOTYPE_OPERATION'.In my conversion I am going to upload per_area,emp_subgroup,payroll_area,work contract and orgn_key for the infotype IT0001 and the input file is from application server.I am using check boxes for these 5 fields and  for the fields I am selecting the checkbox.I want to upload the datas in the IT0001 using HR_INFOTYPE_OPERATION.That is using the call transaction function.Its urgent give me some ideas or codings for that infotype updating.
    Thanks,
    Sakthi.C

    Hi
    you can use <b>open dataset for input</b>,<b>Read dataset</b> for uploading data from a application server.
    Message was edited by:
            Raghu Reddy

  • How to download a file from application server in webdynpro

    Hi Experts,
                       I am trying to download a file through Web Dynpro file download UI element..The file is stored in application server in binary format ..in my code i am reading the file in binary mode,converting Binary File into Xstring(Using FM SCMS_BINARY_TO_XSTRING) ..getting its Mime type and binding the UI element properties (data with XString, Mime type and file name) with respective context attributes..But the problem is file is getting opened but Junk data is getting displayed on it..Not sure where i am making the mistake.

    Hi Lukas,thanks for the reply..please find the code
    here '/tmp/accenturedocs'  is the folder name on application server,and zdocs_list_tab is the table that contains file URL.File upload is on the BSP page (custom logic to upload the file ) where they are storing local file path in ztable.Same i am extracting in my code to get File URL.
    DATA: i_file TYPE rlgrap-filename .
      DATA:v_path TYPE zlist.
      DATA:i_datatab TYPE STANDARD TABLE OF tbl1024,
           wa_datatab TYPE   tbl1024.
      DATA  file TYPE  string.
      DATA dot_offset TYPE i.
      DATA extension TYPE mimetypes-extension.
      DATA mimetype TYPE mimetypes-type.
      SELECT SINGLE description
        FROM  zdocs_list_tab
        INTO v_path.
      CONCATENATE '/tmp/accenturedocs' v_path INTO i_file.
      FIELD-SYMBOLS <hex_container> TYPE x.
      OPEN DATASET i_file FOR INPUT IN LEGACY BINARY MODE.
      IF sy-subrc NE 0.
        MESSAGE e999(00) WITH 'Error opening file' .
      ENDIF.
      ASSIGN  wa_datatab TO <hex_container> CASTING.
      DO.
        READ DATASET i_file INTO <hex_container>.
        IF sy-subrc = 0.
          APPEND wa_datatab TO i_datatab.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET i_file.
      DATA:l_count TYPE i,
            l_len TYPE i.
      DESCRIBE TABLE i_datatab LINES l_count.
      READ TABLE i_datatab INTO wa_datatab INDEX l_count.
      l_len = XSTRLEN( wa_datatab-line ).
      l_len = l_len + ( l_count - 1 ) * 1022.
    DATA: v_xstring TYPE xstring.
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = l_len
        IMPORTING
          buffer       = v_xstring
        TABLES
          binary_tab   = i_datatab
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
      IF sy-subrc <> 0.
      ENDIF.
    file = i_file.
      " Find out file name extension
      FIND FIRST OCCURRENCE OF REGEX '\.[^\.]+$' IN file MATCH OFFSET
      dot_offset.
      ADD 1 TO dot_offset.
      extension = file+dot_offset.
      " Get mime type
      CALL FUNCTION 'SDOK_MIMETYPE_GET'
        EXPORTING
          extension = extension
        IMPORTING
          mimetype  = mimetype.
    DATA lv_file_content TYPE wd_this->element_context-file_content.
    get element via lead selection
      lo_el_context = wd_context->get_element( ).
    set single attribute
      lo_el_context->set_attribute(
        name =  `FILE_CONTENT`
        value =  v_xstring ).
    same way i am assigning file name and file mime type to context attributes.
    please suggest where is the mistake.

  • How to download file from application server to local file using tcode

    Hi,
    I want to download one report output in application sever(/temp/xxx) to local.
    But downloaded excel sheet improper format.
    In downloaded excel sheet having one complete record(12 fields)  in one cell.
    I want to separate it each field in each cell in proper format..[requirement]
    restriction : without using any programs using standard tcode like CG3Y.
    THANKS IN ADVANCE....
    Regards,
    Ragavendran K.
    Moderator message: please search for available information/documentation before asking.
    Edited by: Thomas Zloch on Dec 21, 2010 5:15 PM

    In downloaded excel sheet having one complete record(12 fields) in one cell.
    You did it wrong then.  Post your code and someone will tell you what's wrong with it (or you could search the forum).

  • Delete file from application server

    Hi,
       Can any one tell me how to delete a file from application server?
    Thanks,
    Rahul.

    Basic question, please search for available information.
    Thread locked.
    Thomas

  • T-code for delete file from application server

    Hi all!
    Please, has any t-code for delete file from application server? For upload exist CG3Z, for download has CG3Y. And for delete? Has anyone?
    I need to delete file from application server in QA system and i don't want to create a program for this because i will need to transport a request from DEV to QA.

    I don't have contact with basis team.
    The FM EPS_DELETE_FILE support directory name with max 60 char. My dir. has more than that. I need a transaction for this.
    Anybody know if this transaction exist?

  • Need to copy .txt file from FTP server and downloaded on local server directory.

    I need to figure out a way to copy .txt file from ftp server in local server directory using sql jobs.

    Below links will help achieving it:
    https://www.virtualobjectives.com.au/sqlserver/ftp_scripts.htm
    http://www.mssqltips.com/sqlservertip/2884/sql-server-integration-services-ssis-ftp-task-for-data-exchange/

  • Urgent : Download file from Application Server via Process Chain.

    Hi Experts,
    My requirement is to download the file from Application Server to local work station using an ABAP Program .
    I want including the above ABAP program in a process chain to execute  the program daily,
    I tried to use ARCHIVFILE_SERVER_TO_CLIENT and GUI_DOWNLOAD but unfortunately both the above FM doesn't support to run through Process chain.
    Can any one of you help me to send the code which selects a file from application server, downloads to local system and deletes it.
    Thank you very much for spending your precious time in this regard.

    Hi Sailekha,
    Regarding your case ..
    I suggest you to create the program where it run this function: WS_DOWNLOAD.
    After it, the program is run by your process chain.
    Hopefully it can help you a lot.
    Regards,
    Niel.
    thanks for the points you choose to assign.

  • How to copy file from application server

    Hello experts,
    How to copy file from one folder of application server and paste it to other folder of application server(application server is same)?
    Is there any function module exists???
    thanks in advance
    Saurabh

    Hi you can use this function module to move a file from application server to another folder on application server.
    call function 'WS_FILE_COPY'
               exporting
                    destination = m_destination
                    source      = m_source
               importing
                    return      = return.
    Plus u can use this function module to delete the file from that folder from which u want to replace it.
          call function 'WS_FILE_DELETE'
               exporting
                    file   = m_source
               importing
                    return = return.
    The above FM can help u copy a file from one folder to another and delete the file from that folder.

  • How to copy a file from Client to Application Server

    Hello,
    My requirement is user selects a file from Browse button on oracle form - this location is on client side, and have to copy this file on Application server.
    I tried using webutil_file.copy_file function but it gives error - copy_file is not a procedure or is undefined.
    There is another way of Client_to_AS but it needs some changes in configuration files of webutil, which is not allowed in our scenario.
    Source - client machine resident file
    Target- Application server disk location
    So can any one help in this regard?

    Hi Francois,
    Thanks for your suggestion, actually i didnt want to use Client_to_As as client doesnt want to make any changes in any configuration files, no matter how small the change is.
    Anyways we are able to successfully copy the file using Client_to_AS, but one thing that i couldn't understand is why was our webutil_file.copy_file function failing?
    Any hint about this?
    Thanks!
    Avinash.
    Pune- India.

Maybe you are looking for

  • Creative cloud

    Creative cloud icon is in the status bar, but nothing is happening?

  • Lock box residual amount

    Hello Sapians, I have an issue with the Lockbox when the payment difference is .XX USD. For example I have an invoice of 200 dollars and payterm has 1% discount if you pay in 10 days, now lets say the Customer made a payment of 197.98 USD and when I

  • Gettin the field valus on double clicking and calling the transaction

    Hi how to use call transaction after  clicking on a particular line on the output list with the field values of that line ? I am using MIR4 transaction .Once the output list is displayed when i double click on any line i have to pass the belnr and th

  • How to Develope Charts in Oracle 10G Forms

    hi i want to design charts in 10G forms DS. but i could not find chart builder in 10G. please help me how to design charts in 10G Forms. thanks.

  • (SOLVED) How to automagically add X number of line to new file in vim?

    Basicly I want to add X number of predefined lines of text to every new file I create in vim; if I create file.cpp I want some text, if I create file.sh I want another text. I'm sure this is do-able? Last edited by dmz (2009-07-07 17:51:41)