How to send File on application server for Attachment

Hi,
Friends in my application file is to be sent with Email as an attachment.
all this to be done via servlet for that i have to send the file to application server from there servlet will send mail via Email server.
How can send this file to server.
plz help me .
Thanks

Hi,
The following program illustrates the creation of ifle in app server and reading the file from appli server:
DATA: ITAB LIKE vbakOCCURS 0 WITH HEADER LINE.
PARAMETERS: P_VBELN LIKE VBAP-VBELN.
START-OF-SELECTION.
  SELECT *
    FROM VBAP
    INTO TABLE ITAB
WHERE VBELN = P_VBELN
    PERFORM WRITE_DATA.
    PERFORM READ_DATA.
*&      Form  WRITE_DATA
      text
-->  p1        text
<--  p2        text
FORM WRITE_DATA.
OPEN DATASET 'VBAP_DATA' FOR OUTPUT IN TEXT MODE.
LOOP AT ITAB.
TRANSFER ITAB TO 'VBAP_DATA'.
ENDLOOP.
CLOSE DATASET 'VBAP_DATA'.
CLEAR: ITAB, ITAB[].
ENDFORM.                    " WRITE_DATA
*&      Form  READ_DATA
      text
-->  p1        text
<--  p2        text
FORM READ_DATA.
OPEN DATASET 'VBAP_DATA' FOR INPUT IN TEXT MODE.
DO.
READ DATASET 'VBAP_DATA' INTO ITAB.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
APPEND ITAB.
ENDDO.
CLOSE DATASET 'VBAP_DATA'.
LOOP AT ITAB.
WRITE:/ ITAB-VBELN,
        ITAB-POSNR.
ENDLOOP.
ENDFORM.                    " READ_DATA
If it is helpful rewards points
Regards
Pratap.M

Similar Messages

  • How to create file on application server?

    how to create file on application server?

    Hi,
    The following program illustrates the creation of ifle in app server and reading the file from appli server:
    DATA: ITAB LIKE vbakOCCURS 0 WITH HEADER LINE.
    PARAMETERS: P_VBELN LIKE VBAP-VBELN.
    START-OF-SELECTION.
      SELECT *
        FROM VBAP
        INTO TABLE ITAB
    WHERE VBELN = P_VBELN
        PERFORM WRITE_DATA.
        PERFORM READ_DATA.
    *&      Form  WRITE_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_DATA.
    OPEN DATASET 'VBAP_DATA' FOR OUTPUT IN TEXT MODE.
    LOOP AT ITAB.
    TRANSFER ITAB TO 'VBAP_DATA'.
    ENDLOOP.
    CLOSE DATASET 'VBAP_DATA'.
    CLEAR: ITAB, ITAB[].
    ENDFORM.                    " WRITE_DATA
    *&      Form  READ_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM READ_DATA.
    OPEN DATASET 'VBAP_DATA' FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET 'VBAP_DATA' INTO ITAB.
    IF SY-SUBRC <> 0.
    EXIT.
    ENDIF.
    APPEND ITAB.
    ENDDO.
    CLOSE DATASET 'VBAP_DATA'.
    LOOP AT ITAB.
    WRITE:/ ITAB-VBELN,
            ITAB-POSNR.
    ENDLOOP.
    ENDFORM.                    " READ_DATA
    If it is helpful rewards points
    Regards
    Pratap.M

  • How to download file from application server

    Hi Experts,
                  I developed report and execute in background mode. for this i used Open dataset transfer and close dataset . i got the requried output . But in this case user want downloaded file on presentation server so can anyone tell me How to download file from application server?
    i know it is possible through Tcode CG3Y. but i want code in program.

    This code will download a file to your Client package by package, so it will also work for huge files.
    *& Report  ZBI_DOWNLOAD_APPSERVER_FILE
    REPORT  zbi_download_appserver_file.
    PARAMETERS: lv_as_fn TYPE sapb-sappfad
    DEFAULT '/usr/sap/WBP/DVEBMGS00/work/ZBSPL_R01.CSV'.
    PARAMETERS: lv_cl_fn TYPE string
    DEFAULT 'C:\Users\atsvioli\Desktop\Budget Backups\ZBSPL_R01.CSV'.
    START-OF-SELECTION.
      CONSTANTS blocksize TYPE i VALUE 524287.
      CONSTANTS packagesize TYPE i VALUE 8.
      TYPES ty_datablock(blocksize) TYPE x.
      DATA lv_fil TYPE epsf-epsfilnam.
      DATA lv_dir TYPE epsf-epsdirnam.
      DATA ls_data TYPE ty_datablock.
      DATA lt_data TYPE STANDARD TABLE OF ty_datablock.
      DATA lv_block_len TYPE i.
      DATA lv_package_len TYPE i.
      DATA lv_subrc TYPE sy-subrc.
      DATA lv_msgv1 LIKE sy-msgv1.
      DATA lv_processed_so_far TYPE p.
      DATA lv_append TYPE c.
      DATA lv_status TYPE string.
      DATA lv_filesize TYPE p.
      DATA lv_percent TYPE i.
      "Determine size
      SPLIT lv_as_fn AT '/' INTO lv_dir lv_fil.
      CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
        EXPORTING
          file_name      = lv_fil
          dir_name       = lv_dir
        IMPORTING
          file_size_long = lv_filesize.
      "Open the file on application server
      OPEN DATASET lv_as_fn FOR INPUT IN BINARY MODE MESSAGE lv_msgv1.
      IF sy-subrc <> 0.
        MESSAGE e048(cms) WITH lv_as_fn lv_msgv1 RAISING file_read_error.
        EXIT.
      ENDIF.
      lv_processed_so_far = 0.
      DO.
        REFRESH lt_data.
        lv_package_len = 0.
        DO packagesize TIMES.
          CLEAR ls_data.
          CLEAR lv_block_len.
          READ DATASET lv_as_fn INTO ls_data MAXIMUM LENGTH blocksize LENGTH lv_block_len.
          lv_subrc = sy-subrc.
          IF lv_block_len > 0.
            lv_package_len = lv_package_len + lv_block_len.
            APPEND ls_data TO lt_data.
          ENDIF.
          "End of file
          IF lv_subrc <> 0.
            EXIT.
          ENDIF.
        ENDDO.
        IF lv_package_len > 0.
          "Put file to client
          IF lv_processed_so_far = 0.
            lv_append = ' '.
          ELSE.
            lv_append = 'X'.
          ENDIF.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize         = lv_package_len
              filename             = lv_cl_fn
              filetype             = 'BIN'
              append               = lv_append
              show_transfer_status = abap_false
            TABLES
              data_tab             = lt_data.
          lv_processed_so_far = lv_processed_so_far + lv_package_len.
          "Status display
          lv_percent = lv_processed_so_far * 100 / lv_filesize.
          lv_status = |{ lv_percent }% - { lv_processed_so_far } bytes downloaded of { lv_filesize }|.
          CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
            EXPORTING          "percentage = lv_percent - will make it fash
              text = lv_status.
        ENDIF.
        "End of file
        IF lv_subrc <> 0.
          EXIT.
        ENDIF.
      ENDDO.
      "Close the file on application server
      CLOSE DATASET lv_as_fn.

  • How to upload file from Application Server?

    Dear Friends,
    How to upload file from Application Server?
    Plz. with example...
    Regards,
    Dharmesh

    hi,
    check the code for upload from application server.
    tables: kna1.
    types: begin of s_file,
             customer type kna1-kunnr,
             country  type kna1-land1,
             name     type kna1-name1,
             region   type kna1-regio,
           end of s_file.
    *--Internal tables
    data: it_file type s_file occurs 0 with header line.
    *-- Selection screen
    selection-screen: begin of block b1 with frame title text-001.
    parameter: p_file type rlgrap-filename default 'C:/customer.txt'
    obligatory.
    selection-screen: end of block b1.
    *-- At selection screen
    at selection-screen on value-request for p_file.
    perform file_help using p_file.
    *-- Process File
    start-of-selection.
      perform upload_file using p_file.
    *-- write File data to o/p
    end-of-selection.
      perform write_data.
    *&      Form  file_help
    form file_help  using    p_p_file.
      data: l_filepath type ibipparms-path.
      call function 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       importing
         file_name           = l_filepath
      p_p_file = l_filepath.
    endform.                    " file_help
    *&      Form  upload_file
    form upload_file  using    p_p_file.
      call function 'WS_UPLOAD'
       exporting
         filename                      = p_p_file
         filetype                      = 'DAT'
    IMPORTING
      FILELENGTH                    =
        tables
          data_tab                      = it_file
       exceptions
         conversion_error              = 1
         file_open_error               = 2
         file_read_error               = 3
         invalid_type                  = 4
         no_batch                      = 5
         unknown_error                 = 6
         invalid_table_width           = 7
         gui_refuse_filetransfer       = 8
         customer_error                = 9
         no_authority                  = 10
         others                        = 11
      if sy-subrc <> 0.
        message i001.
      endif.
    endform.                    " upload_file
    *&      Form  write_data
    form write_data .
      loop at it_file.
        write:/ it_file-customer, it_file-country, it_file-name,
                it_file-region.
      endloop.
      endform.
    regards,
    keerthi.

  • How to handle file on application server without coading?

    HI all,
    can anybody tell me How to handle file on application server without coading? Is there any solution?
    Thanks in advance.

    > can anybody tell me How to handle file on application server without coading? Is there any solution?
    what is that you want to handle. what you do if you don't code ...

  • How to transfer file from application server to presentation server in background?

    Hi Experts,
    How to transfer file from application server to presentation server in background?
    Thanks in advance
    Namita

    Thanks Raman and Challa,
    We want to move file from application server to Shared folder, not on local machine. We checked FM which you guys have provided but those are not able to read file from application server.
    We need this program to run in background so that we can use this in daily process chain.
    Appreciate your inputs on this.
    Thanks,
    Namita

  • How to delete file from application server(Unix)

    Hi All,
    Using the below code downloading a file from application server(Unix) to client machine. I want to delete the file from application server once it is downloaded to client
    We work on Forms 11.1.1.4.0 and Oracle DB 10g. Client machine are Windows 7.
    BEGIN
      IF webutil_file_transfer.AS_to_Client
      (clientFile => Name_In('global.g_file_name')
      ,serverFile => ls_AppServer_Loc)THEN
      message('Data exported Successfully');
      ELSE
       message('File download from Application Server failed');
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
      message('File download failed: '||SUBSTR(sqlerrm,1,200));
      END;
    I have search for solution on OTN. Few suggested to use HOST.
    Can any one help me how to use Host() built_in to delete the file.
    Thanks,
    Maddy

    Can any one help me how to use Host() built_in to delete the file.
    Host('/bin/rm <complete file path>');

  • How to  store file in Application server.

    Hi all,
    I have done a report where using excel sheet data i hv to insert in ztable. I have done it i hav  converted excel sheet data into internal table and then inserted into ztable. It is working properly. using p_file like rlgraph-filename i have taken the parameter and function module filename_f4 uploaed file.
    Now i when i am runing the report it is inserting properly in foreground. But  i have requirement that i have to run the report in background but it is giving error in background. So what i do is the excel sheet which i take as input should be stored in Application server and then i have to pick up the file from application server during the background process. So any body can tell me how to write the program  to store file in application server and pickup that file again to run it in background.
    <b>useful answers will be rewarded</b>
    Regards,
    Sunil kumar.

    HI
    see this program where EXCEL to INTERNAL TABLE and then TO APPLICATION server
    REPORT  ZSD_EXCEL_INT_APP.
    parameter: file_nm type localfile.
    types : begin of it_tab1,
            f1(20),
            f2(40),
            f3(20),
           end of it_tab1.
    data : it_tab type table of ALSMEX_TABLINE with header line,
           file type rlgrap-filename.
    data : it_tab2 type it_tab1 occurs 1,
           wa_tab2 type it_tab1,
           w_message(100)  TYPE c.
    at selection-screen on value-request for file_nm.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    *   PROGRAM_NAME        = SYST-REPID
    *   DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
       STATIC              = 'X'
    *   MASK                = ' '
      CHANGING
       file_name           = file_nm
    EXCEPTIONS
       MASK_TOO_LONG       = 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.
    start-of-selection.
    refresh it_tab2[].clear wa_tab2.
    file = file_nm.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file
        i_begin_col                   = '1'
        i_begin_row                   =  '1'
        i_end_col                     = '10'
        i_end_row                     = '35'
      tables
        intern                        = it_tab
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 2
       OTHERS                        = 3
    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_tab.
      case it_tab-col.
       when '002'.
        wa_tab2-f1 = it_tab-value.
       when '004'.
        wa_tab2-f2 = it_tab-value.
      when '008'.
        wa_tab2-f3 = it_tab-value.
    endcase.
    at end of row.
      append wa_tab2 to it_tab2.
    clear wa_tab2.
      endat.
    endloop.
    data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        MESSAGE e001(zsd_mes).
        EXIT.
      ELSE.
    *---Data is downloaded to the application server file path
        LOOP AT it_tab2 INTO wa_tab2.
          TRANSFER wa_tab2 TO p_file.
        ENDLOOP.
      ENDIF.
    *--Close the Application server file (Mandatory).
      CLOSE DATASET p_file.
    loop at it_tab2 into wa_tab2.
      write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
    endloop.

  • How best store files on application server: Tables vs File system

    Hi Experts,
    We want to let users to upload files to application server. The number of files can potencially grow over time (1000 files every month) though I whould like to limit size of each file not more than 1-2 MB.
    Also files should be classified (having custom attributes) so later on we need to search, select files according to attributes.
    So what are the best options in long run (for performance, reliability etc)?
    We have NW system 7.0 with MaxDB
    I can think of the following options:
    1. Store files in TRANSPARENT table in RAWSTRING. Easiest variant (to select files etc) Here I have concerns how this table and database behave after some period of time and what will happen if size will grow to let say 50 GB. Will it work? What are normal size limits for transparent tables?
    2. Store files in CLUSTER table in RAWSTRING. Less convenient to work with (joins are not allowed etc). Will cluster table help to handle big size of table? What are practical size limits for cluster tables?
    3. Store files on file system (on application server) and write info (attributes etc) into ztable. Select from ztable and read content file from file system (dataset commands?). So files will be written to one directory just one after another.
    What are the best option to follow? I would personally prefer option 1 as easiest but have servious concerns regarding size of one transparent table.
    What do you recommend?
    Regards,
    Dmitry.
    Edited by: Dmitry Kalmykov on Jul 28, 2009 8:58 AM

    Hi,
    I too feel that option 1 would be best choice.
    For your ref: Check the Transp.table REPOSRC and the field name DATA
    Also Check the technical settings (Size category).

  • How to search file in application server using pattern

    Hi all,
    I want to search file in application server.
    Suppose there is file named abc20090808.dat.
    Is there is any function module to search the file?
    it should return back the file names starting with abc, if the import parameter is abc*
    Regards,
    Nikhil

    hello,
                 Have a look
            You can use this function module /SAPDMC/LSM_F4_SERVER_FILE for F4 help for application server file and then you can use the function module TEXT_CONVERT_XLS_TO_SAP to read data into internal table.
      access file from application server
    regards,
    shweta

  • How to download files from Application Server of Unix o.s to local director

    Hi All,
    I am trying to download files from Apllication server of Unix operating Systems to local file in excel sheet format using a z-program.but whenever I am trying to use OPEN dataset ........
    it is showing sy-subrc = 8.
    Can I have any clew please.
    Thanks in advance,
    Regards,
    AMEER.

    Hi Sreekanth,
    Thanks a lot for quick reply.I have to download that files from z-program only. I am giving you my code below.
    *& Report  ZTRAK_DOWNLOAD                                         *
    REPORT  ZTRAK_DOWNLOAD  MESSAGE-ID ZCT                   .
    SELECTION-SCREEN BEGIN OF BLOCK DOWNLOAD WITH FRAME TITLE TEXT1.
      PARAMETERS :
           SERDIR LIKE RLGRAP-FILENAME DEFAULT '/usr/trak',
           LOCDIR LIKE RLGRAP-FILENAME DEFAULT 'C:\Trak'.
    SELECTION-SCREEN END OF BLOCK DOWNLOAD .
    SELECTION-SCREEN BEGIN OF BLOCK INFO2 WITH FRAME.
           SELECTION-SCREEN COMMENT 1(79) TEXT2.
           SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT3.
    SELECTION-SCREEN END OF BLOCK INFO2 .
    SELECTION-SCREEN BEGIN OF BLOCK INFO3 WITH FRAME.
           SELECTION-SCREEN COMMENT 1(79) TEXT4.
           SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT5.
            SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT6.
           SELECTION-SCREEN SKIP 1.
           SELECTION-SCREEN COMMENT 1(79) TEXT7.
           SELECTION-SCREEN SKIP 2.
           SELECTION-SCREEN COMMENT 1(79) TEXT8.
    SELECTION-SCREEN SKIP 1.
           SELECTION-SCREEN COMMENT 1(79) TEXT9.
    SELECTION-SCREEN END OF BLOCK INFO3.
    *- Internal Table to output data in Excel
    DATA: BEGIN OF tab_excel OCCURS 0,
            col1(50),
            col2(132),
            col3(255),
            col4(100),
            col5(100),
            col6(50),
            COL7(60),
            col8(30),
            col9(30),
            col10(30),
            col11(20),
            col12(15),
            col13(15),
          END OF tab_excel.
    DATA: FILE LIKE RLGRAP-FILENAME .
    DATA: W_DATASET(80).
    INITIALIZATION.
      TEXT1  = 'Download Reports'.
      TEXT2 = 'The Program downloads the reports generated by Trak'.
      TEXT3 = 'Utility from Server to Local PC.'.
      TEXT4 = 'Check the following before executing the Program.'.
      TEXT5 = '     1. A valid Server path is provided.'.
      TEXT6 = '     2. A valid Local PC path is provided.'.
      TEXT7 = '     3. Local PC has 10 MB free space.'.
      TEXT8 = 'The report can be executed in the forground.'.
    TEXT9 =
    'The report should be executed after execution of Transaction TRAK'.
    AT SELECTION-SCREEN.
    IF SERDIR EQ ''.
    MESSAGE E001(ZCT).
    ENDIF.
    IF LOCDIR EQ ''.
    MESSAGE E002(ZCT).
    ENDIF.
    START-OF-SELECTION.
    Download ABAP Development Summary Report
    FILE =  '\ABAP_Report_Developments.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/ABAP_Report_Developments.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download BDC Development Report
    FILE =  '\BDC_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/BDC_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Development Summary Report
    FILE = '\Developments_Summary_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Developments_Summary_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Enhancement Development Report
    FILE =  '\Enhancement_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Enhancement_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download field exit Development Report
    FILE =  '\Field_Exit_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Field_Exit_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Frequency & Purpose Report
    FILE =  '\Frequency_And_Purpose_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Frequency_And_Purpose_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Function Group Developments Report
    FILE =  '\FunctionGroup_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionGroup_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Function Module Developments Report
    FILE = '\FunctionModule_Developments_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionModule_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Include Developments Report
    FILE =  '\Include_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Include_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download UserGroup Developments Report
    FILE =  '\UserGroup_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/UserGroup_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Modified_Standard_SAP_Objects_Report
    FILE = '\Modified_Standard_SAP_Objects_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Modified_Standard_SAP_Objects_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Include Developments Report
    *FILE =  '\Include_Developments_Report.XLS'.
    *CONCATENATE LOCDIR FILE INTO FILE.
    *W_DATASET = '/Include_Developments_Report.dat'.
    *CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    *PERFORM INIT.
    Download SAP Script Developments Report
    FILE =  '\SAP_Scipt_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/SAP_Scipt_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Transaction Developments Report
    FILE =  '\Transaction_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Transaction_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download User Exits Developments Report
    FILE =  '\UserExits_Reports.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/UserExits_Reports.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download ABAP Query Developments Report
    FILE =  '\ABAPQuery_Developments_Reports.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/ABAPQuery_Developments_Reports.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Functional Area Developments Report
    FILE =  '\FunctionalArea_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionalArea_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    MESSAGE S003(ZCT) WITH LOCDIR.
    END-OF-SELECTION.
    This routine checks whether file exists if yes downloads it to
    the Local PC
    FORM INIT.
    OPEN DATASET W_DATASET FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    DO.
       IF SY-SUBRC <> 0.
          EXIT.
       ENDIF.
       READ DATASET W_DATASET INTO  tab_excel.
       APPEND tab_excel.
       CLEAR tab_excel.
    ENDDO.
         PERFORM DOWNLOAD_FILE.
    ENDFORM.
    This routine downloads the data in an XL format on local PC
    FORM Download_File .
      CALL FUNCTION 'WS_DOWNLOAD'
                EXPORTING
                     FILENAME                = FILE
                     FILETYPE                = 'DAT'
                TABLES
                     DATA_TAB                = tab_excel
                EXCEPTIONS
                     FILE_OPEN_ERROR         = 1
                     FILE_WRITE_ERROR        = 2
                     INVALID_FILESIZE        = 3
                     INVALID_TYPE            = 4
                     NO_BATCH                = 5
                     UNKNOWN_ERROR           = 6
                     INVALID_TABLE_WIDTH     = 7
                     GUI_REFUSE_FILETRANSFER = 8
                     CUSTOMER_ERROR          = 9
                     OTHERS                  = 10.
        IF sy-subrc <> 0.
         message ''.       " Error in file transfer
        ELSE.
          CLEAR TAB_EXCEL.
          REFRESH TAB_EXCEL.
          FILE = ''.
          W_DATASET = ''.
        ENDIF.
    ENDFORM.
    I have created those files in Application Server running in another z-program in background mode.Then I am trying to download those files using above the program.I am creating those trak/Trak files manually and I can able to see those files in A.S level.But when downloading the same files I am facing the problem.
    regards,
    Ameer

  • How to delete files from application server posted in last 30 days

    I have some files in application server posted through ABAP program with the below format
    \.\.\.abcd_20110209_111209.csv   (with  date and time). I need to delete those files which was posted in last 30 days through another program. Could you plaese help me to achieve the requirement?

    There are many ways you can delete/archive files in application servers.
    1. Depending on the application server, usually administrators setup delete/archive programs. For e.g. if the application server is a UNIX, then the unix admin will write a script to delete/move older files. - this is the most common approach I've seen.
    If you have to achieve this through ABAP then,
    1. You can get the script from the server admin and then use that script to create an external system command through SM69/49 and use the function module SXPG_COMMAND_EXECUTE to execute it.
    2. You can also look at FM EPS_DELETE_FILE and see if it fits the bill for you.
    There are many other possibilities too and each one has its own pros/cons. So you'll have to choose the right one for your requirement.

  • 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 get files from application server

    Hi
    I got a requirement like i have some n number of file in application server at specified path now i want to get that files from application server to presentation server.
    Please help me out.
    Thanks in advance.
    Regards
    Krishna

    HI.
    Use this Unix script. Give IP and other details as ur requirment.
    Setup variables. #
    Input Directory > #
    Output Directory > #
    Source System > #
    Target System > #
    Files FTPed > lxxxxx* #
    set -x
    DATE="`date +%y%m%d%H%M%S`"
    FTP destination details.
    ftp_host=""
    ftp_user=" "
    ftp_pass="a"
    ftp_remote_dir=" "
    File path and names
    host_dir=""
    ftp_local_file="lxxxx"
    ftp_local_file_dir=" "
    ftp_arch_dir=" "
    ftp_output=" "
    FTP
    if -f $ftp_local_file_dir ; then
    ftp -i -n -d -v $ftp_host<<EOINPUT >$ftp_output
    user $ftp_user $ftp_pass
    cd $ftp_remote_dir
    lcd $host_dir
    mget $ftp_local_file
    bye
    EOINPUT
    mv $ftp_local_file_dir $ftp_arch_dir$ftp_remote_file_name
    else
    echo "ERROR: Local $ftp_local_file_dir does not exist.">>$ftp_output;
    fi
    exit;
    Edited by: Jay on Feb 14, 2008 5:36 PM

  • Re: How to send data to  Application Server

    HI Experts,
    Can anyone tell me how to send alv report ouput data to the application server.
    Regards,
    p11272

    Hi,
    You can use Open dataset to transfer internal tables to application server.
    Given below is the Simple code that will help you to extend.
    Parameters to enter the path
    PARAMETERS FILENAME(128) DEFAULT '/usr/tmp/testfile.dat'
                             LOWER CASE.
    Table Declaration
    TABLES VBAK.
    Data Declaration
    DATA D_MSG_TEXT(50).
    Get data for file transfer
    DATA INT_VBAK LIKE VBAK OCCURS 100
                       WITH HEADER LINE.
    SELECT * FROM VBAK INTO TABLE INT_VBAK.
    SORT INT_VBAK BY VBELN.
    LOOP AT INT_VBAK.
      WRITE: / INT_VBAK-VBELN,
               INT_VBAK-KUNNR.
    ENDLOOP.
    Opening the File
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                          MESSAGE D_MSG_TEXT.
    IF SY-SUBRC NE 0.
      WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
      EXIT.
    ENDIF.
    Transferring Data
    LOOP AT INT_VBAK.
      TRANSFER INT_VBAK-VBELN TO FILENAME.
    ENDLOOP.
    Closing the File
    CLOSE DATASET FILENAME.
    Thanks
    shankar

Maybe you are looking for

  • Material Movements issue in BEX report

    Hi Friends We have one report which shows the report on the production date, batch number, number of expired products and non expired products etc. recently in R/3, people have changed the production date for few batches and now the BW report is disp

  • 300 GB iphoto library on a 1tb time capsule disk is locked

    iPhoto library 300GB  on a Time capsule I use this so I can  access my photos and back up the library wirelessly.  I navigate to the backup I was using the Finder to go through the Time Capsule, when I click on the iPhoto library to access pictures .

  • My MacBook Pro does not boot

    Dear forum I need some support. I have upgraded my MacBook Pro 2.2 to Leopard. Defined a Vista 32 Home Premium (original) Bootcamp partition. Everything has worked fine till yesterday. Now there is no way to boot the sistem anymore. If you select Mac

  • Largedataset in spry causes IE to throw alert

    HI,      I am using spry to load a large datset which consists around 1000 records. I am using the code snippet mentioned below to load the records from xmlstring which i get from server side. var  xmlDOMDocument = ""; var  agencyAccounts = new Spry.

  • IMac stripes appear on the screen

    My iMac 17 inch intel core 2 duo has failed, the display came rays of different colors and also the menu bar disappeared