Unable to download file to application server

Hi,
I am trying to download a file to the application server. I've also attached my code below.After the execution of this program, it is just returning blank values to the application server file. Let me know why it is not populating the values to the files.
Raj.
tables: kna1,
        knb1.
DATA: BEGIN OF itab_ls OCCURS 0,
       kunnr LIKE kna1-kunnr,
       altkn LIKE knb1-altkn,
     END OF itab_ls.
TYPES : BEGIN OF t_file,
          date(5) TYPE c,   " Date
          time(5) TYPE c,   " Time
        end of t_file.
DATA : gt_file TYPE TABLE OF t_file, " File Path
       g_spath TYPE fileextern,   " Path
       g_fieldname   TYPE dynfnam. " Field Name
SELECTION-SCREEN BEGIN OF BLOCK b_01 WITH FRAME TITLE text-b01.
SELECT-OPTIONS s_erdat FOR kna1-erdat obligatory.
SELECTION-SCREEN END   OF BLOCK b_01.
SELECTION-SCREEN BEGIN OF BLOCK b_02 WITH FRAME TITLE text-b02.
SELECTION-SCREEN BEGIN OF LINE.
Radio button for Presentation server file
PARAMETERS    : p_pres RADIOBUTTON GROUP file DEFAULT 'X'
                USER-COMMAND file.
SELECTION-SCREEN COMMENT 3(20)  text-s01 FOR FIELD p_pres.
SELECTION-SCREEN END   OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 23(22) text-s02 FOR FIELD p_flnam1
                                               MODIF ID com.
Presentation server file Name
PARAMETERS    : p_flnam1 TYPE localfile MODIF ID com ."MEMORY ID zp1.
SELECTION-SCREEN END   OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
Radio button for Application server file
PARAMETERS    : p_app RADIOBUTTON GROUP file  .
SELECTION-SCREEN COMMENT 3(20)  text-s03 FOR FIELD p_app.
SELECTION-SCREEN END   OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 23(22) text-s04 FOR FIELD p_flnam2
                                               MODIF ID com.
Application server file Name
PARAMETERS    : p_flnam2 TYPE localfile MODIF ID com ."MEMORY ID zp2 .
SELECTION-SCREEN END   OF LINE.
SELECTION-SCREEN END   OF BLOCK b_02.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnam1.
  g_fieldname = 'P_PCFILE'.
  PERFORM call_pres_help USING    g_fieldname
                         CHANGING p_flnam1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnam2.
  PERFORM call_app_help CHANGING p_flnam2.
AT SELECTION-SCREEN OUTPUT.
Start-of-selection.
SELECT kna1kunnr knb1altkn kna1ktokd kna1erdat
INTO CORRESPONDING FIELDS OF TABLE itab_ls
FROM kna1 INNER JOIN knb1 ON kna1kunnr = knb1kunnr WHERE kna1~erdat in
s_erdat AND KNA1KTOKD = 'Z002' order by kna1kunnr.
OPEN DATASET p_flnam2 for output IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
  LOOP AT itab_ls.
    TRANSFER itab_ls TO p_flnam2.
  ENDLOOP.
  CLOSE DATASET p_flnam2.
endif.
WRITE:/'SAP Ship-toCustID', 18 'LegacyCustID'.
ULINE.
Loop at itab_ls.
  write: /3 itab_ls-KUNNR, 18 itab_ls-ALTKN.
endloop.
PERFORM download_file.
*&      Form  call_pres_help
      text
     -->P_FIELDNAME  text
     -->P_PARAMETER  text
FORM call_pres_help  USING    p_fieldname    TYPE dynfnam
                    CHANGING p_parameter    TYPE localfile.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = sy-repid
      dynpro_number = sy-dynnr
      field_name    = p_fieldname
    IMPORTING
      file_name     = p_parameter.
ENDFORM.                    "call_pres_help
*&      Form  call_app_help
      text
     -->P_PARAMETER  text
FORM call_app_help  CHANGING p_parameter    TYPE localfile.
  CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
      directory        = g_spath
    IMPORTING
      serverfile       = p_parameter
    EXCEPTIONS
      canceled_by_user = 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.
ENDFORM.                    "call_app_help

Hi,
If the SY-SUBRC is equal to 8, then error is nothing but "The file could not be opened". So pls check the file name again.
And for write statement,
If SY-SUBRC = 4 then the Contents of name are invalid, statement could not be executed, and contents of destination remain unchanged. So pls do check this also.
regs,
Venkat Ramanan
Message was edited by: Venkat Ramanan Natarajan

Similar Messages

  • 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.

  • Error in PDF Conversion while downloading file from application server

    Hi,
    I am facing a problem in which i have to download file from application server which is a PDF file (output of SAP Script). I am downloading this file using following code in BSP technology:
    * event handler for data retrieval
    EMPCD = REQUEST->GET_FORM_FIELD( 'emp' ).
    MONTH = REQUEST->GET_FORM_FIELD( 'mn' ).
    YEAR  = REQUEST->GET_FORM_FIELD( 'yr' ).
    W_IND = 'N' .
    DATA : wa_zform16 type  zform16.
    DATA : file_path type string.
    DATA : l_pdf_len type string.
    DATA STR TYPE STRING.
    DATA: OUTPUT    TYPE STRING ,
          L_XSTRING TYPE XSTRING ,
          APP_TYPE  TYPE STRING.
    DATA: PDF_TABLE TYPE  RCL_BAG_TLINE.
    DATA PHY_NAME_OUT     TYPE SAPB-SAPPFAD.
    concatenate '/usr/sap/put/form16/' EMPCD '_' YEAR '.PDF'  into file_path
    *PHY_NAME_OUT = '/usr/sap/put/form16/01000200_2007.PDF'.
    PHY_NAME_OUT = file_path.
    OPEN DATASET PHY_NAME_OUT FOR INPUT IN TEXT MODE ENCODING default.
    IF SY-SUBRC IS INITIAL.
      DO.
        READ DATASET PHY_NAME_OUT INTO STR.
        IF SY-SUBRC IS INITIAL.
          CONCATENATE
              OUTPUT
              STR
              CL_ABAP_CHAR_UTILITIES=>CR_LF
          INTO OUTPUT.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      APP_TYPE = 'APPLICATION/PDF'.
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          TEXT     = OUTPUT
                MIMETYPE = 'APPLICATION/PDF'
    *            MIMETYPE = 'APPLICATION/PDF;charset=utf-16le'
        IMPORTING
          BUFFER   = L_XSTRING.
      CALL METHOD CL_BSP_UTILITY=>DOWNLOAD
        EXPORTING
          OBJECT_S            = L_XSTRING
          CONTENT_TYPE        = APP_TYPE
          CONTENT_DISPOSITION = 'attachment;filename=webforms.pdf'
          RESPONSE            = _M_RESPONSE
          NAVIGATION          = NAVIGATION.
    Result of this code is : there is a pop up asking to open or save pdf format and process is complete, but i have problem in downloaded file.
    At the time of creation i have put BMP image for signature in PDF file and it is working fine but when i upload that file in Application server and then download it with above used code it save the PDF file but when i open that file so whereever i have used signature that page gives error and could not display that scanned signature.
    Can anyone please help me in this regard.
    or is there any possibility from which i can download that file just like File transfer from BSP.
    Keep in mind that i am using BSP technology so all GUI based function module to download file are not working.
    waiting for your reply.....
    Regards,
    Gagan

    Hi Raja,
    I have standard sap form for TDS Certificate on which i have include an BMP image for digital signature and download that script into pdf format.While i download that PDF looks ok but it is not working in BSP.
    Regards,
    Gagan

  • Downloading file from application server to presentation server

    Hi,
          We have a requirment to download file from application server to presentation server.  The problem is while down loading, some of the filds showing some junk values. Instead of that junk values we have some Russian texts there.  These Russian texts only coming as junk all other data is correct.  The file in the appplication server is in .dbf format. We are downloading using WS_DOWNLOAD. file type is BIN and code page we didn't specified.
    Thanks in Advance
    Jijeesh.P.G
    Message was edited by: Jijeesh.P.G
            Jijeesh P G

    hi jijeesh,
       Welcome to SDN.
    u can use to download file from application server to presentation server using the t/c CG3Y. in that it will ask the source file path and the target file path.
    if u want to find the source file path in the application server, u can use the transaction AL11 to find that one.
    Regards....
    Arun.
    Reward points if useful.

  • Downloading file to application server

    Hi,
    I have requirement of downlaoding some (.doc,.xls,.txt,.ppt) files into application server from sap r/3,the file will be picked by some other 3rd party application.
    I was able to achieve it using OPEN DATA SET and TRANSFER,but the data gets encrytped and the actual file is not copied to application server.(example if its .doc file the same file data should be copied to app server and not the encrypted file data like 5%%#.......6234726&&%212).
    The encrypted file again displays like exact file as its uploaded when downloaded from app server.
    But the file in app server is encrypted,my requirement is to copy the exact file to app server.
    This encryption is happening when is OPEN DATA SET and TRANSFER,even the FM ARCHIVFILE_CLIENT_TO_SERVER is also using  OPEN DATA SET and TRANSFER only.
    Please suggest me any other way to move file to app server other than OPEN DATA SET and TRANSFER.
    Thanks,
    Phani.

    Hi,
    If you are downloading the file from application server, you have to use OPEN DATASET CLOSE DATASET.
    I think you are making some mistake in your code.
    Refer to my code below and let me know if you have any doubt.
    *&      Form  APL_DOWNLOAD
          DOWNLOADING FILE TO APPLICATION SERVER.
    FORM apl_download .
      IF NOT i_output[] IS INITIAL.
    IF NOT p_pathdl is initial.
        IF v_flag <> c_chk.                          "IF search help was not called.
          CLEAR:     v_filename,
                        v_path.
    Building File Name.
          CONCATENATE c_mf018
                      v_date
                      v_time
                      c_extn
                 INTO v_filename.
    Conactenating File Name and File Path for Dataset parameter.
          CONCATENATE p_pathdl
                      c_slash
                      v_filename
                 INTO v_path.
        ELSE.                                        "IF search help was called.
          v_path = p_pathdl.
        ENDIF.
    Local Data Declaration.
        DATA v_string  TYPE string.
    Creating a file of given name at given path on apllication server.
        OPEN DATASET v_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc = 0.
    Building header and transfering it to the file.
          CONCATENATE text-004 c_sep text-005 c_sep text-006 c_sep
                      text-007 c_sep text-008 c_sep text-009 c_sep
                      text-010 c_sep text-011 c_sep text-012 c_sep
                      text-013 c_sep text-014 c_sep text-015 c_sep
                 INTO v_string.
          TRANSFER v_string TO v_path.
          CLEAR v_string.
    Reading data from internal table & transfering to file.
          LOOP AT i_output INTO w_output.
            CONCATENATE w_output-lifnr      c_sep w_output-banksrec   c_sep
                        w_output-bankkrec   c_sep w_output-banknrec   c_sep
                        w_output-waers      c_sep w_output-bankssnd   c_sep
                        w_output-bankksnd   c_sep w_output-chainno    c_sep
                        w_output-chainbankt c_sep w_output-chainbanks c_sep
                        w_output-chainbankk c_sep w_output-chainbankn
                  INTO v_string.
            TRANSFER v_string TO v_path.
            CLEAR: v_string,
                   w_output.
          ENDLOOP.
        ELSE.
          MESSAGE i000 WITH text-040.
          EXIT.
        ENDIF.
        MESSAGE i000 WITH text-038 v_path.
      ELSE.
        MESSAGE i000 WITH text-048.
      ENDIF.
      ELSE.
        MESSAGE i000 WITH text-041.
      ENDIF.
    ENDFORM.                    " APL_DOWNLOAD

  • Background Job - Requirement to download file to application server

    Dear All,
    If I want to execute one function module in background and the FM is downloading file to application server, the FM is not downloading file to application server. Can you please suggest whether it is possible to download file to application server when it is in background mode? I know it is not possible to download file to presentation server.
    Thanks and regards,
    Atanu

    Hi,
    Yes, it is possible to download a file to application server in background mode. check the path ur sepcifying to the Function module to download the file...in T-Code AL11 check if the path exits.
    reward if helpful
    Regards,
    Rahul

  • While downloading file to application server its overwriting the earlier fi

    hi if i am using below code with date time stamp the file is downloaded to the application server correctly and each time i execut eht program a difference file is generated as date time stamp differs each time but
    whne i remove the date time stamp ie sy-datum and sy-uzeit as we dont need to display the date time stamp with the file each time i execute the program a file is generated but it overwrites the ealier existing file please suggest as each time it shoul generate a new file....
    Concatenate file name sy-datum sy-uzeit '.txt' into v_datetimefile
    file on Appplication Server is selected
      CALL FUNCTION 'FILE_GET_NAME'
         EXPORTING
                CLIENT                        = SY-MANDT
               logical_filename              = 'ZFILE'

    Hi,
    first of all decide you have to overwrite the existing file or you want to create the new, i think the answer is there in your query itself, if you want to create new then concatenate the date and time, else don't do that.
    below are the additions we can use while opening the data set.
    FOR INPUT
    FOR OUTPUT
    FOR APPENDING
    IN BINARY MODE
    IN TEXT MODE
    AT POSITION p
    TYPE ctrl
    MESSAGE mess
    FILTER f
    Reward if useful.
    Thanks,
    Sreeram.

  • 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 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

  • Unable to Open File In Application Server

    Hi All,
    I have generated csv file in application Server with the help of Open HUb Destination.In Open Hub 2 files will we generated(1 is structure of the file(s_ztest),2 is data file(ztest)).When i click on the structure of the file then it is opening,but when im tryin to open data file(i,e(ztest)its giving an message like UNABLE TO OPEN THE FILE.
    Please let me know how it can be opened.
    Thanks In Advance,
    Bobby

    Hi All,
    File is Opening,it was an error in filed mapping....

  • Special characters downloading file into application server

    Dear Friends,
    i have to download records into excel sheet through back ground job, while downloading records into applications server.
    all records are downloading properly up to here fine but some special characters also downloading. i had downloaded same records in debugging mode from the same internal table here no special characters.
    i found that the structure(standard ( /SCWM/S_LIME_ALL_MON )) which is being used in that some fields are defined as RAW data type this may be the problem.but i tried to convert them using some function modules no result getting dump only.
    i am using data sets to download data into application server here gui_download will not work because it is back ground job.
    can any one please help me in this. its urgent...
    please please help me in this it has been pending since DEC-01-11.
    extra characters like (  #v#M?LQia#####
    #v#M?LQia#####
    #v#)
    my code
      open DATASET LV_FLNAM for OUTPUT in LEGACY BINARY MODE .
      IF sy-subrc EQ C_ZERO.
        LOOP AT LT_TAB INTO WA_TAB.
          transfer WA_TAB to LV_FLNAM.
        ENDLOOP.
        CLOSE DATASET LV_FLNAM.
      ENDIF.
    Edited by: sairam.kusuma on Dec 16, 2011 6:26 AM
    Edited by: sairam.kusuma on Dec 16, 2011 6:38 AM
    Edited by: sairam.kusuma on Dec 16, 2011 6:39 AM

    TYPES:BEGIN OF ty_stru,
          LGTYP  TYPE /SCWM/LGTYP,
          LGPLA  TYPE /SCWM/LGPLA,
          MATNR  TYPE /SCWM/DE_MATNR,
          MAKTX  TYPE /SCWM/DE_UI_MAKTX,
          QUAN(13)  TYPE C,"/SCWM/DE_UI_QUAN,
          UNIT  TYPE /SCWM/DE_BASE_UOM,
          CAT  TYPE /SCWM/DE_CAT,
          CAT_TXT  TYPE /SCWM/DE_CAT_TXT,
          CHARG  TYPE /SCWM/DE_CHARG,
          OWNER  TYPE /LIME/OWNER,
          ENTITLED  TYPE /SCWM/DE_ENTITLED,
          UI_WDATT  TYPE /SCWM/DE_UI_WDATT,
          UI_WDATU  TYPE /SCWM/DE_UI_WDATU,
          SKZSI  TYPE /SCWM/LQUA_SKZSI,
          QUANA(13)  TYPE C,"/SCWM/DE_UI_QUAN_PACKED,
          ALTME  TYPE /SCWM/DE_AUNIT,
          ITMNO  TYPE /SCDL/DL_ITEMNO,
          WEIGHT(15)  TYPE C,"/SCWM/DE_NWEIGHT,
          UNIT_W  TYPE /SCWM/DE_WGT_UOM,
          VOLUM(15)  TYPE C,"/SCWM/DE_NVOLUME,
          UNIT_V  TYPE /SCWM/DE_VOL_UOM,
          CAPA(15)  TYPE C,"/SCWM/DE_CAPAUSE,
          SN_STOCK  TYPE /SCWM/DE_SER_STOCK,
          END OF ty_stru.
    DATA: LV_LGNUM TYPE /SCWM/LGNUM VALUE 'R10',
          LV_FLNAM TYPE rlgrap-filename VALUE '/tmp/RAMA.xls'.
    CONSTANTS: C_ZERO TYPE I VALUE '0'.
    DATA: LT_TAB TYPE STANDARD TABLE OF /SCWM/S_LIME_ALL_MON,
          WA_TAB TYPE /SCWM/S_LIME_ALL_MON,
          i_stru TYPE STANDARD TABLE OF ty_stru,"
          wa_stru TYPE ty_stru.
    REFRESH LT_TAB.
    CLEAR: WA_TAB.
    *this is modified function module from /SCWM/S_LIME_ALL_MON
    CALL FUNCTION 'ZEWM_F_PHYSICAL_INVENTORY_STOC'
      EXPORTING
        IV_LGNUM             = LV_LGNUM
      IV_VARIANT           =
      IV_MODE              = '1'
      IT_DATA_PARENT       =
      IMPORTING
        ET_DATA              = LT_TAB
      EV_RETURNCODE        =
      EV_VARIANT           =
    CHANGING
      CT_TAB_RANGE         =
    i have to download what are the fields defined as structure.
    1)when ever i am using the internal table(LT_TAB) to download getting specials characters(####) with all records for the fields QUAN, QUANA, WEGHT,VOLUM and CAPA.
    open DATASET LV_FLNAM for OUTPUT in LEGACY BINARY MODE .
    IF sy-subrc EQ C_ZERO.
      CLEAR: WA_stru,
             wa_tab.
      LOOP AT LT_TAB INTO WA_TAB.
        transfer WA_TAB to LV_FLNAM.
        CLEAR: WA_TAB.
      ENDLOOP.
      CLOSE DATASET LV_FLNAM.
    ENDIF.
    2)if i take another internal table with converting them as char file is downloading with out special characters but it is downloading single line only but not the hole data.
    if i have the below code getting only single line records not total records without special characters.
    open DATASET LV_FLNAM for OUTPUT in LEGACY BINARY MODE .
    IF sy-subrc EQ C_ZERO.
      CLEAR: WA_stru,
             wa_tab.
      LOOP AT LT_TAB INTO WA_TAB.
         wa_stru-LGTYP = wa_tab-LGTYP.
         wa_stru-LGPLA = wa_tab-LGPLA.
         wa_stru-MATNR = wa_tab-MATNR.
         wa_stru-MAKTX = wa_tab-MAKTX.
         wa_stru-QUAN = wa_tab-QUAN.
         wa_stru-UNIT = wa_tab-UNIT.
         wa_stru-CAT = wa_tab-CAT.
         wa_stru-CAT_TXT = wa_tab-CAT_TXT.
         wa_stru-CHARG = wa_tab-CHARG.
         wa_stru-OWNER = wa_tab-OWNER.
         wa_stru-ENTITLED = wa_tab-ENTITLED.
         wa_stru-UI_WDATT = wa_tab-UI_WDATT.
         wa_stru-UI_WDATU = wa_tab-UI_WDATU.     
         wa_stru-SKZSI = wa_tab-SKZSI.
         wa_stru-QUANA = wa_tab-QUANA.
         wa_stru-ALTME = wa_tab-ALTME.
         wa_stru-ITMNO = wa_tab-ITMNO.
         wa_stru-WEIGHT = wa_tab-WEIGHT.
         wa_stru-UNIT_W = wa_tab-UNIT_W.
         wa_stru-VOLUM = wa_tab-VOLUM.
         wa_stru-UNIT_V = wa_tab-UNIT_V.
         wa_stru-CAPA = wa_tab-CAPA.
         wa_stru-SN_STOCK = wa_tab-SN_STOCK.
        transfer WA_stru to LV_FLNAM.
        CLEAR: WA_stru.
      ENDLOOP.
      CLOSE DATASET LV_FLNAM.
    ENDIF.

  • Downloading file from application server in Binary mode

    Hi,
    I am trying to read an application server file using open dataset in Binary Mode..
    While downloading using gui_download method the file is getting truncated because of its size.
    My questions are,
           How to increase the size of the internal table dynamically. Already tried using STRING type but it is not accepting.
           If I use the CHAR type with maximum length 65535 and if the length of the file is less than that then in the remaining spaces box like symbols are printed .
    How can I achieve it.
    Thanks & Regards,
    NJ

    TYPES: BEGIN OF type_download,
               data1 TYPE zchar20000,
               data2 TYPE zchar20000,
               data3 TYPE char3000,
               data4 TYPE char2000,
             END OF type_download.
      DATA: lt_download TYPE STANDARD TABLE OF type_download,
            lx_download TYPE string,
            lv_filename TYPE string.
    Read data from application server to internal table
      OPEN DATASET p_p_ftappl FOR INPUT IN BINARY MODE.
      IF sy-subrc = 0.
    Read file
        DO.
          CLEAR lx_download.
          READ DATASET p_p_ftappl INTO lx_download.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          APPEND lx_download TO lt_download.
        ENDDO.
    Download data to presentation server from internal table
        lv_filename = p_p_ftfron.
    Download data from application server to PC
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
       bin_filesize              =
            filename                  = lv_filename
            filetype                  = c_bin
       append                    = space
          write_field_separator     = space
       header                    = '00'
       trunc_trailing_blanks     = 'X' "space "commented
       trunc_trailing_blanks_eol = 'X' "added
    IMPORTING
       filelength                =
          CHANGING
            data_tab                  = lt_download.
    *Exceptions deleted            .
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Close file
        CLOSE DATASET p_p_ftappl.
    Edited by: NewJoinee123 on Mar 25, 2010 8:45 AM

  • Downloading File on Application server

    Hi All,
    I have wriitten a code for Downloading a data on application server.
    I wanted to add Summary details for the same extract .
    I have collected all the summary details in the internal table of type string .
    I am using TRASPORTING for moving Summary deatils to File on application server and then again transporting Extarct .
    But in the summary details ,I am getting last line of that not complete summary.
    I used this table (string type) for Presentation server and its working fine there.
    Please help me out.
    ans will b rewarded.
    Thanks
    Hemant

    Hi,
    Make sure you have the TRANSFER statement with in the internal table loop..
    LOOP AT ITAB.
      TRANSFER ITAB TO '/tmp/test.txt'.
    ENDLOOP.
    Thanks,
    Naren

  • Japanese character problem while downloading file to application server

    Hello All,
    We are facing a strange problem while downloading a file to application server when file contains japanese text.
    We are downloading vendor and customer information in a flat file format on application server. When the login language is EN program show ouput in a properly formatted manner.
    When the login language is JA (japanese) program does download file with customer vendor data. I can see the description is japanese language but the formatting is gone for a toss.
    We are facing similar issue with other programs downloading files on the application server.
    I am using OPEN DATASET........ENCODING DEFAULT. and working on unicode enabaled ECC 6.0 system
    Quick help appriciated.
    Thanks!

    Hi
    Sometimes this also happens because of your desktop setting.Make sure that your OS also supports the JAPANESSE language.
    Ask your technical support team to enable them in your desktop.
    Thanks & Regards
    Jyo

  • Regarding downloading file on application server ?

    i am using open data set and close data set to create file on application server.
    the program is compiling fine, but when i execute it, it throws a dump saying
    DATASET_NOT_OPEN  , it says that the file is not open.
    when i check value of sy-sub-rc it is 8. no file on server.
    i want to create a dynamic file name, like i want to append the sy-cdate to the file name, so that when i schedule my program every day, i will create a new file.
    what is the t-code to look at directories on app server. i tried al11, but couldnt find mine..but the basis said they had already created a folder for me there.
    - Points will be awarded for inputs.
    Message was edited by:
            ravi a

    Hi,
    May be you don't have write permission for the corresponding folder on the application server. thats why you could not create file on that folder.so ask you basis people for read/write permission on the that destination folder..
    For creating dynamic file , you can use logical file and physical file concept..
    for each interface maintain a logical file name in a ztable and ask your basis people to maintain a physical file path on application server for each logical file name.(using FILE Txn).
    first get the logical file name from ztable then get corresponding physical path onapplication server using FM 'FILE_GET_NAME' and finally concatenate the sydatun to physical file name...
    DATA: l_file_folder TYPE string,
            l_logical_file TYPE fileintern,
      CLEAR: file1.
    *<b> First get the logical file name from table zabc021</b>
      SELECT SINGLE log_file " Actual file location
                         INTO l_logical_file
      FROM zabc021
      WHERE interface = p_interface
        AND inorout = 'O'. "outbound interface
    <b>* Get the physical file name from the logical file name</b>
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
      CLIENT                        = SY-MANDT
          logical_filename              = l_logical_file
       IMPORTING
         file_name                     = l_file_folder
       EXCEPTIONS
         file_not_found                = 1
         OTHERS                        = 2
      IF sy-subrc = 0.
    <b>* In actual situation the file name should come from FILE txn</b>
        CONCATENATE l_file_folder
        p_interface '_' sydatum4(2) sydatum6(2) '.DAT' INTO file1.
      ELSE.
        CLEAR file1.
        MESSAGE s999 WITH 'No logical file maintained with name ' l_logical_file.
        EXIT.
      ENDIF.
    now file1 is the file name.
    I hope this info is useful to you...
    Reward if needful

Maybe you are looking for

  • Partner Application Definition

    I want to register a partner application to portal. (Oracle Exchange) I registered it as partner application and registered the web provider also. But clicking the link still dismisses me to the login page on the partner application side. What am I m

  • How to get the bound object of an external table with OMB

    Hello, I try to find it but without success. So may be one of you, know this secret information. I want to synchronize with the help of an OMB script my external tables. OMBSYNCHRONIZE FLAT_FILE '/MY_PROJECT/MY_FLAT_FILE_MODULE/MY_FLAT_FILE' RECORD '

  • Connections is not always established

    I m trying on my site flash player comunication. Connection synhronization is on my site. Connection between some IP s is established well and continue to the end of call. But between another IP s is not established at all. What it may be ? My site  

  • Extract PDL from a PDF document

    Hello, I'm trying to perform the following task but doesn't find a solution. I have a PDF stored on my Content server (KPRO) and want to print it using the SAP spool(SP01).I have try to use the FM ADS_SR_OPEN of creation of spool directly but i need

  • How to send a smartform result through mail?

    How to send a smartform result through mail?