Download file to excel

Hai everyone,
I have a requirement where i need to have a button in the view and on clicking of the button i need to download the data into excel file.
can anyone please explain this procedure in detail.
It is urgent,
Please donot refer some other threads, becoz i already had a look at them.
Quick reponses are appreciated.
Cheers,
Madhu.

>Please donot refer some other threads, becoz i already had a look at them.
Really, you have already read every possible thread on the subject?
You haven't given many details about your particular requirement.  I assume your data is tabular if you are going to excel, so why not use display the data using the ALV component and the you get download to excel function out of the box?
Otherwise you will have to convert your data to a format that excel will understand.  Text tab delimited is easiest, but you do lose formatting options.  The actual download process is simple and well documented in the online help.

Similar Messages

  • Download files in excel format

    Hi,
    Can anyone help me for downloading file in excel format? I have scheduled a job repeated everyday at a particular time, but it dumps a text file, NOT in excel format. My programme is an ALV.
    Code snippet would be verymuch helpfull.
    Thank,
    Thushara.

    Hello Thushara,
    here is a code i am giving you . It will take the data from a database , and download it into the excel format..
    You just can customize this program to download the data from an ALV ....
    Here is the sample code...
    REPORT  ZKUN_FILE4                              .
    TABLES: USR03,DD02L.
    DATA: ZX030L LIKE X030L.
    DATA BEGIN OF ZDFIES OCCURS 0.
         INCLUDE STRUCTURE DFIES.
    DATA END OF ZDFIES.
    DATA: BEGIN OF FLDITAB OCCURS 0,
          FLDNAME(11) TYPE C,
          END OF FLDITAB.
    DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.
    DATA TNAME LIKE DD02L-TABNAME.
    SELECT * FROM USR03 INTO TABLE ITABUSR03.
    TNAME = 'USR03'.
    PERFORM GETFIELEDS.
    PERFORM SHOW123.
    FORM GETFIELEDS.
         CALL FUNCTION 'GET_FIELDTAB'
          EXPORTING
              LANGU              = SY-LANGU
              ONLY               = SPACE
              TABNAME            = TNAME
              WITHTEXT           = 'X'
          IMPORTING
              HEADER             = ZX030L
          TABLES
              FIELDTAB           = ZDFIES
          EXCEPTIONS
              INTERNAL_ERROR      = 01
              NO_TEXTS_FOUND      = 02
              TABLE_HAS_NO_FIELDS = 03
              TABLE_NOT_ACTIV     = 04.
         CASE SY-SUBRC.
            WHEN 0.
              LOOP AT ZDFIES.
                   FLDITAB-FLDNAME = ZDFIES-FIELDNAME.
                   APPEND FLDITAB.
              ENDLOOP.
            WHEN OTHERS.
                 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  with  SY-SUBRC.
          ENDCASE.
    ENDFORM.
    FORM SHOW123.
    CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
         EXPORTING
              FILE_NAME                 = 'C:\USR03.XLS'
              DATA_SHEET_NAME           = 'USER LIST'
        TABLES
             DATA_TAB                  =  ITABUSR03
             FIELDNAMES                =  FLDITAB
        EXCEPTIONS
             FILE_NOT_EXIST            = 1
             FILENAME_EXPECTED         = 2
             COMMUNICATION_ERROR       = 3
             OLE_OBJECT_METHOD_ERROR   = 4
             OLE_OBJECT_PROPERTY_ERROR = 5
             INVALID_FILENAME          = 6
             INVALID_PIVOT_FIELDS      = 7
             DOWNLOAD_PROBLEM          = 8
             OTHERS                    = 9.
    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.
    Hope this solves your problem.
    Regards,
    Kunal.
    Note : Reward points if found useful.

  • Suppress the single quote when display downloaded file in EXCEL

    I have a requirement to keep all the cells contents left-justisfied when display in EXCEL. I used GUI_DOWNLOAD and concatenate a single quotes to the numeric fields in my internal table. However, when open the file in EXCEL, the single quote show up in the cell also. Anyone knows how to suppress the single quote when open in EXCEL? Here are my codes:
    concatenate '''' itab-field2 into itab-field2.
    modify itab.
       CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
           filename                      = 'c:test_xls.xls'
           FILETYPE                      = 'ASC'
           WRITE_FIELD_SEPARATOR         = 'X'
         tables
           data_tab                      = itab.
    Thank you,

    Check the below program :
    REPORT ZJOINS message-id z01. .
    *REPORT ZTEST3 line-size 400.
    DATA : V_CHAR(1) TYPE C VALUE ''''.
    data : v_field(12) type c.
    data : begin of itab occurs 0,
           fld1(12) type c,
           end of itab.
    start-of-selection.
    v_field = '0000012345'.
    CONCATENATE V_CHAR  V_FIELD  INTO V_FIELD.
    itab-fld1 = v_field.
    append itab.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
        FILENAME                      =
        'C:\Documents and Settings\smaramreddy\Desktop\fff.xls'
       FILETYPE                      = 'ASC'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = itab
      FIELDNAMES                    =
    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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I just tried one field in internal table,i am not sure this program help you
    Thanks
    Seshu

  • Download file thru excel with password

    Hello ABAPers,
    I used the EXCEL_OLE_STANDARD_DAT with password protected...my problem is .once this fm executed...the excel file appeared and sheets are not read only..Id like to do,once the file is downloaded to excel...and FM was executed...the excel file must not appear to the user..how can i done this using this FM ?
    please hellllllppppp....
    Thanks in advance..
    will reward points to good answers
    aVaDuDz

    Hello Atish,
    Thanks for the reply...If its not possible..is there any FM that i can use to download excel...and much possible protected by password? i tried other FMs...like GUI_DOWNLOAD.WS_EXCEL..but this EXCEL_OLE_STANDARD_DAT fit my requirements..but it automatically open the excel file which is supposed to be hide to the user ..for security purpose.
    Thanks in advance..
    aVaDuDz

  • Very urgent : Problem in currency field while downloading file from excel.

    I downloaded a excel file to my ABAP program.It contains a currency field which has comma in it. When i do operations on the currency field it says unable to interpret the number.Can anybody help me on this.
    Message was edited by:
            Bharath Srinivas
    Message was edited by:
            Bharath Srinivas

    Hi,
    Try this. In ur excel right click on that column wher u have the currency, go to format cells and there uncheck the box which shows 'Show tousands (,) seperator).That shud solve the problem.
    Thanks
    Vasudha

  • Trouble downloading file from crystal reports to excell

    Using crystal report windows forms viewer and one work station is recieving this when attempting to download file into excell can anyone identify problem?
    Error in file C:\Docume1\GBRADF1.sup\locals~1\temp\temp\-a60ab760-f79f-4184-alf5-352333bblffe2.rpt:
    error detected by export DLL
    Thanks for any help

    Moving to .NET SDK Forum
    What happens if you try exporting that same report in Crystal Report Designer?
    Also need to know what version of VS .NET and CR runtime you are using.
    Thank you
    Don

  • Download file from UNIX to EXCEL problem

    Hi,
    I am trying to download file from UNIX server to excel file, there is one column which is messing up and that is number 100000000000000002 (18 in length) it is writing as 1E+17, funny thing is when I click on that cell it is showing as
    100000000000000000.
    I am using GUI_DOWNLOAD to download to excel, below is the output excel format, I am talking about 4th value from left
    GUID    leg_reg     lic_type     lic_num     ex_lic_num     vali_from     valid_to     created_by
    3E633B85C05E6F28E100     EAR     ENC     1E+17     ENC     20030305     20930305     VANRIJ
    below is the program I am using to download the output from UNIX to excel
    FORM get_data_file.
      OPEN DATASET p_unxfil FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0.
        DO.
          READ DATASET p_unxfil INTO input_file_tab-line_string.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          APPEND input_file_tab.
          CLEAR  input_file_tab.
        ENDDO.
      ELSE.
        PERFORM write_message USING 'ZZ' 'E' '000'
          'Unable to find file' p_unxfil
          '  Press Enter key to exit.' ''.
      ENDIF.
      CLOSE DATASET p_unxfil.
      DESCRIBE TABLE input_file_tab LINES record_cnt.
    ENDFORM.                    " get_data_file
    FORM create_pc_file.
      DATA: l_file TYPE string.
      MOVE p_pcfile TO l_file.
    Save the file
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_file
        TABLES
          data_tab                = input_file_tab
        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 NE 0.
        WRITE: / 'Error creating pc file', p_pcfile.
        EXIT.
    endif.
    I will assure of points.
    Thanks for your help
    Sarath

    It is not the problem of your program. This happens becuase of the "nature" of the excel. You need to retain the text property of that column.
    Try like this:
    1. Download the file in .txt
    2. Open Excel .. blank sheet
    3. Now, click on Open. Select your .txt file
    4. One pop up will come ..."Text Import Wizard"
    5. Select the fixed width or Delimited ... Press Next ...
    6. Select appropriate delimitors or fixed length .. press Next
    7. Select your coulumn (which has the problem), Select the "Text" radiobutton on the upper-right corner and finish.
    Regards,
    Naimesh Patel

  • Downloading ALV to excel file

    Hi all,
       i am trying to download ALV to excel file.
       but as the alv contains many fields,
       the row in the excel is automatically wrapped to the
       next row ..
       what i want is the row in excel should come as it is
       in the ALV (whole thing in one line) and should not wrap to next row
      Regards,
      Tarang

    Hi Shah,
    <b>
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'</b>
        EXPORTING
          I_CALLBACK_PROGRAM      = V_REPID
          I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
          IS_LAYOUT               = WA_LAYOUT
          I_SAVE                  = 'A'
          IT_FIELDCAT             = I_FLDCAT_HEAD
          IT_SORT                 = IT_SORT
          IT_EVENTS               = I_EVENTS
        TABLES
          T_OUTTAB                = IT_FINAL
        EXCEPTIONS
          PROGRAM_ERROR           = 1
          OTHERS                  = 2.
      IF SY-SUBRC = 0.
    <b>     CALL FUNCTION 'GUI_DOWNLOAD'</b>
         EXPORTING
          BIN_FILESIZE                    =
            FILENAME                        = 'C:\Documents and Settings\vikranthk\Desktop\vikranth.xls'
           FILETYPE                        = 'ASC'
          APPEND                          = ' '
          WRITE_FIELD_SEPARATOR           = ' '
          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_final.
          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
    Thanks
    Vikranth Khimavath
    Message was edited by: Khimavath Vikranth

  • Downloading a file to excel sheet

    To all forum people 
    While I download an internal table into an excel-sheet I would like to place a field name in the excel-sheet corresponding to each field in my internal table so how could this be done are there any function modules pertaining to this issue or is there any other method to do this.....
    murali

    Hi 
    The following is a sample code download to EXCEL file
    REPORT Sample
    NO STANDARD PAGE HEADING
    LINE-SIZE 180
           LINE-
            COUNT 90                                             0001-
            LINE-COUNT 65                                             "0001+
            MESSAGE-ID z1.
    TABLES: MARC.
    DATA : BEGIN OF i_marc OCCURS 0,
           matnr LIKE marc-matnr,            "Material
           werks LIKE marc-werks,            "Plant     
           mmsta LIKE marc-mmsta,            "MM/PP Status
           ekgrp LIKE marc-ekgrp,            "Purchasing Group
           dispo LIKE marc-dispo,            "MRP Controller
           plifz LIKE marc-plifz,            "PDT (Planned Dlv Time)
           webaz LIKE marc-webaz,            "GRT (Goods Receipt Time)
           fevor LIKE marc-fevor,            "Production Scheduler
           insmk LIKE marc-insmk,            "Post to Inspection Stock
           ladgr LIKE marc-ladgr,            "Loading Group
           kautb LIKE marc-kautb,            "Automatic PO     Allowed
           kordb LIKE marc-kordb,            "Source List
           prctr LIKE marc-prctr,            "Profit Center
           lgpro LIKE marc-lgpro,            "Issue Storage Location
           abcin LIKE marc-abcin,            "Cycle Count Phys Inventory Ind
           sernp LIKE marc-sernp,            "Serial Number Profile
           lgfsb LIKE marc-lgfsb,            "Stor Loc for External Procure
           END OF i_marc.
    STRUCTURES DECLARATION
    DATA: BEGIN OF wf_msg.
            INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF wf_msg.
    DATA : BEGIN OF rec_marc,
           matnr(18),
           z_delim1(1),
           werks(4),
           z_delim2(1),
           mmsta(2),
           z_delim3(1),
           ekgrp(3),
           z_delim4(1),
           dispo(3),
           z_delim5(1),
           plifz(3),
           z_delim6(1),
           webaz(3),
           z_delim7(1),
           fevor(3),
           z_delim8(1),
           insmk(1),
           z_delim9(1),
           ladgr(4),
           z_delim10(1),
           kautb(1),
           z_delim11(1),
           kordb(1),
           z_delim12(1),
           prctr(10),
           z_delim13(1),
           lgpro(4),
           z_delim14(1),
           abcin(1),
           z_delim15(1),
           sernp(4),
           z_delim16(1),
           lgfsb(4),
           z_delim17(1),
           END OF rec_marc.
    VARIABLES DECLARATION
      DATA: w_lines   like sy-tabix,
            w_records like sy-tabix.
    ****DELIMETERS DECLARATION
      DATA: p_del  type c  value ',',        "delimeter
            p_del1 type c  value ';'.        "delimeter
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:
      s_matnr FOR marc-matnr,
      s_werks FOR marc-werks,
      s_mmsta FOR marc-mmsta,
      s_ekgrp FOR marc-ekgrp,
      s_dispo FOR marc-dispo,
      s_plifz FOR marc-plifz,
      s_webaz FOR marc-webaz,
      s_fevor FOR marc-fevor,
      s_insmk FOR marc-insmk,
      s_ladgr FOR marc-ladgr,
      s_kautb FOR marc-kautb,
      s_kordb FOR marc-kordb,
      s_prctr FOR marc-prctr,
      s_lgpro FOR marc-lgpro,
      s_abcin FOR marc-abcin,
      s_sernp FOR marc-sernp,
      s_lgfsb FOR marc-lgfsb.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION SCREEN FOR DOWN LOAD OPTION
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    PARAMETERS:
      r_list  radiobutton group a1,
    p_del   default ',',                  "delimeter
    DATA: p_filePC TYPE rlgrap-filename value 'C:\zmarc.xls',
          typ TYPE rlgrap-filetype value 'DAT',
          fname TYPE rlgrap-filename,
          ftype TYPE rlgrap-filetype,
          fsize TYPE i.
    SELECTION-SCREEN END OF BLOCK blk2.
    START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM get_data.
    END-OF-SELECTION
    END-OF-SELECTION.
    if r_list = 'X'.
        PERFORM output_list.
      elseif r_dldPC = 'X'.
        PERFORM download_file_PC.
      endif.
    *&      Form  get_data
          Get data from table MARC
    FORM get_data.
    CLEAR: i_marc. REFRESH: i_marc.
      SELECT matnr
             werks
             mmsta
             ekgrp
             dispo
             plifz
             webaz
             fevor
             insmk
             ladgr
             kautb
             kordb
             prctr
             lgpro
             abcin
             sernp
             lgfsb
        INTO TABLE i_marc
           FROM marc
             WHERE matnr IN s_matnr
             AND werks IN s_werks
             AND mmsta IN s_mmsta
             AND ekgrp IN s_ekgrp
             AND dispo IN s_dispo
             AND plifz IN s_plifz
             AND webaz IN s_webaz
             AND fevor IN s_fevor
             AND insmk IN s_insmk
             AND ladgr IN s_ladgr
             AND kautb IN s_kautb
             AND kordb IN s_kordb
             AND prctr IN s_prctr
             AND lgpro IN s_lgpro
             AND abcin IN s_abcin
             AND sernp IN s_sernp
             AND lgfsb IN s_lgfsb.
    ENDFORM.                    " get_data
    *&      Form  output_list
          Output List with Column Headings
    FORM output_list.
      CLEAR: w_lines.
      DESCRIBE TABLE i_marc LINES w_lines.
      if w_lines gt 0.
        ULINE.
        WRITE:/28  'MM/PP',
              38  'MRP',
              48  'Prod',
              58  'Purch',
              68  'Profit',
              80  'Planned',
              92  'GR',
              100 'Post to',
              114 'Auto',
              122 'Source',
              132 'Issue',
              140 'CC Phys',
              150 'Loading',
              160 'Serial No',
              172 'SLoc'.
        WRITE:/1  'Material',
              20  'Plant',
              28  'Status',
              38  'Ctrlr',
              48  'Sched',
              58  'Grp',
              68  'Ctr',
              80  'Dlv. Time',
              92  'Time',
              100 'Insp. Stock',
              114 'PO',
              122 'List',
              132 'SLoc',
              140 'Indicator',
              150 'Group',
              160 'Profile',
              172 'for EP'.
        ULINE.
        LOOP AT i_marc.
          WRITE:/   i_marc-matnr,
                20  i_marc-werks.
          set left scroll-boundary." Added to keep the left 2 columns fixed
                                   while viewing the list online
          WRITE:28  i_marc-mmsta,
                38  i_marc-dispo,
                48  i_marc-fevor,
                58  i_marc-ekgrp,
                68  i_marc-prctr,
                80  i_marc-plifz,
                92  i_marc-webaz,
                100 i_marc-insmk,
                114 i_marc-kautb,
                122 i_marc-kordb,
                132 i_marc-lgpro,
                140 i_marc-abcin,
                150 i_marc-ladgr,
                160 i_marc-sernp,
                172 i_marc-lgfsb.
        ENDLOOP.
        ULINE.
      endif.
    ENDFORM.                    " output_list
    *&      Form  download_file_PC
          Download file to Local directory on PC
    FORM download_file_PC.
    CLEAR: w_lines, w_records.
      DESCRIBE TABLE i_marc LINES w_lines.
      if w_lines gt 0.
    Download file
        PERFORM open_file using p_filePC.
        PERFORM output_file_PC.
        PERFORM close_file using p_filePC.
        PERFORM write_summary.
      endif.
    ENDFORM.                    " download_file_PC
    *&      Form  write_summary
    FORM write_summary.
      write : / '******************************************************'.
    write : / '****     PROGRAM IS ENDED SUCCESSFULLY           **'.0001-
      write : / '****   PROGRAM HAS ENDED SUCCESSFULLY         *****'."0001+
      write : / '******************************************************'.
      skip.
      write : /  'No. of recds written  :', 38 w_records.
      skip.
      if r_dldUx = 'X'.
        write : /  'Output file name : ' , p_fileUX.
      elseif r_dldPC = 'X'.
        write : /  'Output file name : ' , p_filePC.
      endif.
      skip.
      write : / '******************************************************'.
    ENDFORM.                    " write_summary
    *&      Form  open_file
          text
         -->P_P_FILEUX  text
    FORM open_file USING output_file.
      OPEN DATASET output_file FOR OUTPUT IN TEXT MODE.
      if sy-subrc <> 0.
    Send technical message
        CLEAR wf_msg.
        wf_msg-msgid  = 'ZB'.
        wf_msg-msgnr  = '003'.
        wf_msg-msgtyp = 'E'.
        wf_msg-msgv1  = output_file.
        CALL FUNCTION 'Z_ERROR'
             EXPORTING
                  msg    = wf_msg
                  pid    = sy-cprog
             EXCEPTIONS
                  others = 1.
      endif.
    ENDFORM.                    " open_file
    *&      Form  close_file
          Close File
    FORM close_file USING    output_file.
      close dataset output_file.
      if sy-subrc <> 0.
    Send technical message
        clear wf_msg.
        wf_msg-msgid  = 'Z3'.
        wf_msg-msgnr  = '003'.
        wf_msg-msgtyp = 'E'.
        wf_msg-msgv1  = output_file.
        call function 'Z_ERROR'
             EXPORTING
                  msg    = wf_msg
                  pid    = sy-cprog
             EXCEPTIONS
                  others = 1.
      endif.
    ENDFORM.                    " close_file
    *&      Form  output_file_PC
          Write Data to Local PC File
    FORM output_file_PC.
    DATA: BEGIN OF i_PCFile OCCURS 0,
              rec(2000) TYPE C,
          END OF i_PCFile.
      data: dload_record(1000).
      DATA: flength TYPE i.
    Transfer Header Line
      clear: dload_record.
      concatenate 'Material' 'Plant' 'MM/PP Status' 'Purch Grp.' 'MRP Ctrl.'
                  'Planned Dlv. Time' 'GR Time' 'Prod Sched'
                  'Post to Insp. Stock''Loading Group''Auto PO'
                  'Source List''Profit Ctr.' 'Issue SLoc''CC Phys Indicator'
                  'Serial No Profile' 'SLoc for EP'
                   into dload_record
                   separated by p_del.
      condense dload_record no-gaps.
      i_PCFile-rec = dload_record.
      append i_PCFile.
      clear i_PCFile.
    Transfer Data
      loop at i_marc.
        w_records = w_records + 1.
        clear: rec_marc, dload_record.
        move-corresponding i_marc to rec_marc.
        move p_del to:  rec_marc-z_delim1, rec_marc-z_delim2,
                        rec_marc-z_delim3, rec_marc-z_delim4,
                        rec_marc-z_delim5, rec_marc-z_delim6,
                        rec_marc-z_delim7, rec_marc-z_delim8,
                        rec_marc-z_delim9, rec_marc-z_delim10,
                        rec_marc-z_delim11,rec_marc-z_delim12,
                        rec_marc-z_delim13,rec_marc-z_delim14,
                        rec_marc-z_delim15,rec_marc-z_delim16,
                        rec_marc-z_delim17.
        move rec_marc to dload_record.
        condense dload_record no-gaps.
        i_PCFile-rec = dload_record.
        append i_PCFile.
        clear i_PCFile.
      endloop.
      IF p_filePC NE SPACE.
        CALL FUNCTION 'DOWNLOAD'
             EXPORTING
                  filename            = p_filePC
                  filetype            = typ
             IMPORTING
                  act_filename        = fname
                  act_filetype        = ftype
                  filesize            = fsize
             TABLES
                  data_tab            = i_PCFile
             EXCEPTIONS
                  invalid_filesize    = 1
                  invalid_table_width = 2.
        IF SY-SUBRC NE 0.
          WRITE 'File can not be opened'.
        ENDIF.
    Begin 0001+
      Set PC Filename to whatever is returned from the Function Module, to
      display later
        p_filePC = fname.
    End 0001+
      ELSE.
        WRITE:/ 'Please Enter File Name'.
      ENDIF.
    ENDFORM.                    " output_file_PC
    if it helps please reward points
    Regards
    Prabhakar

  • Problem in Download data into Excel File

    Hi Friends,
    I have one doubt on WDJ.
             I have got the data from the Back and display the data into Table UI Element. Depending upon po_status equals to OA Pending that time conf_Ship_date Column is Empty. That time we can Select All Checkbox Click on Download Button Excel file is not download. Why it not download? Conf_Ship_date Column is Empty. Conf_Ship_date Column is data available that time data download into Excel File.
    My Req: if Conf_Ship_date Column is empty that time click on Download that data will download in to Excel. In Excel Conf_Ship_date Column will display in NULL or 00.00.0000 Like this also.
    Code:ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    This means I am getting date from PoDetails_OutTab(StockEle)this node and add this date to PoDetails_ExcelData(ExcelEle) this node.Finally the date will available in PoDetails_ExcelData this node. By Using this node I will download data.
    How to do this work?
    Regards
    Vijay

    Hi Arun,
    For Example in Table 4 rows and 14 columns data is available. Select all check boxes click on download button total 4 rows and 14 columns data is downloaded.
    Table 4 rows and 14 columns data is available. But in some cells data not available in that time I m getting null values from ECC System. That time I am not able to download.
    In Particularly this problem I am getting only date colums.
    So now I have develop this code
    public void onActiondownloadToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActiondownloadToExcel(ServerEvent)
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataNode ExcelNode = wdContext.nodePoDetails_ExcelData();
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataElement ExcelEle; 
         IPrivatePO_Details_ResultView.IPoDetails_OutTabNode StockNode = wdContext.nodePoDetails_OutTab();
         IPrivatePO_Details_ResultView.IPoDetails_OutTabElement StockEle ;
         for(int i = 0 ;i<StockNode.size();i++)
         StockEle = StockNode.getPoDetails_OutTabElementAt(i);
         if(StockEle.getCheckBox()== true)
         ExcelEle = ExcelNode.createPoDetails_ExcelDataElement();// Create Element
         if(StockEle.getConf_Shp_Date()==null)
         java.sql.Date deliverydate1=new java.sql.Date(0,0,0);
         ExcelEle.setConf_Shp_Date(deliverydate1);
         else
         ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    By using this code i have to download total Records but in this Conf_Shp_Date colums i am getting 31-12.1899 this output in Excel. But i need in Excel to print Null or 00.00.0000 like
         ExcelEle.setQuantity(StockEle.getQuantity());
         ExcelEle.setDeliv_Date(StockEle.getDeliv_Date());
         if(StockEle.getExpt_Shp_Date()==null)
         java.sql.Date deliverydate2=new java.sql.Date(0,0,0);
         ExcelEle.setExpt_Shp_Date(deliverydate2);
         else
         ExcelEle.setExpt_Shp_Date(StockEle.getExpt_Shp_Date());
         ExcelEle.setVendor_Material(StockEle.getVendor_Material());
         ExcelNode.addElement(ExcelEle);
         if(ExcelNode.size()>0)
         wdThis.wdGetCO_POPendingController().downloadData(wdContext.nodePoDetails_ExcelData());// This is for Downalod data Method
         wdThis.wdGetCO_POPendingController().DownLoadToExcel();// This is for Open Popup Window
         wdContext.nodePoDetails_ExcelData().invalidate();
         else
         wdComponentAPI.getMessageManager().reportException("Please select any one po item from the table",true);
        //@@end
    Regards
    Vijay
    Edited by: KalluriVijay on May 18, 2010 10:05 AM

  • Downloading report in excel file

    When I download reoprt in excel file then if material no is 0002134 then in the excel file this becomes 2134,
    I am saving file from the Menu System->Save-> Local fiie and then selecting spreadsheet.
    When I save as text file then it is not removing leading zeros, only in excel file it is removing leading zeros.
    I wanted to know that how to download in excel file so that my material no should download as it is .
    Thanks
    APrasad

    Menu System->Save-> Local fiie and then selecting spreadsheet.
    Spreadsheet is not EXCEL. It is a an internal format.
    if you enter xls as extension, then you just tell Microsoft to open this file with excel.
    Excel then automatically coverts it to its own rules.
    When download with Menu System->Save-> Local fiie and then selecting spreadsheet enter the file extension txt
    Then open Excel, use file > open
    find your file and open it, Excel will come up with an import assistant.
    there you can define if the column is to be loaded as numbers or text.

  • Downloading table to excel-file obeying special conditions

    hi all.
    i download the internal table to excel file. the excel file is not initial, it has a header line (names of fields). I need to add the data from the table to the file, overwriting the previous data(if it was), but saving the header line. one more requirement: i need to be able to set visible length of each field. is it possible to do using standard function 'GUI_DOWNLOAD'?
    thanks all in advance.

    With GUI_DOWNLOAD, you could only append (and not an actual XLS file, but a DAT or TXT file)
    You should try to use OLE instructions, look at <a href="http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm">Download a report to excel with format (border, color cell, etc)</a> for a sample program using OLE.
    Regards

  • Error when downloading a file to Excel

    Hi all
    When trying to download a file with function "WS_DOWNLOAD" to Excel I am getting the following error:
    "Error no. 5 in SAPGUI with Graphics call or file transfer"
    And then:
    "E5: illegal data in download file 'C:\Shipment.xls (WK1 Conversion)'"
    But this errors only occurs in some pcs.
    Anybody knows what could be happening?
    Thanks,
    Iratxe

    Hi,
    Please check your
    1. File type
    2. and file name type.
    p_fnam2 LIKE rlgrap-filename.
    filetype = 'DAT'
      CALL FUNCTION 'WS_DOWNLOAD'
           EXPORTING
                filename                = p_fnam2
                filetype                = 'DAT'
           TABLES
                data_tab                = i_download
           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 i352.                          "File downloded successfully
      ENDIF.
    Moreover GUI_DOWNLOAD is prefererred to WS_DOWNLOAD.
    or use: call cl_gui_frontend_services
    This link will give u some tips on downlaoding files.
    http://www.sapdevelopment.co.uk/file/file_updown.htm
    Best Regards,
    Anjali

  • How to hide/remove a column from Excel download file

    All,
    I have about 7 columns iam displaying on my IR but there is 1 column on this report i dont want to appear on excel download file. How do i accomplish this?
    apex 4.1.0/theme20/report region,
    thanks in advance,

    Hello,
    For IR, each download format is associated with specific REQUEST value. For CSV files, its CSV. So you can put the condition for columns using :REQUEST value as follows.
    Goto Report Attributes -> Select Column you want to hide for CSV export -> Conditional Display
    Condition Type- PL/SQL
    Expression1- :REQUEST IS NULL OR :REQUEST != 'CSV'
    Regards,
    Hari

  • I can't download PDF files or excel files from my email

    Why I cannot download PDF or excel files from my email. I click on the attach but it does nothing at all

    You are saying that files are not opened in the mail app when you are reading the email or the file does not open when you tap on the icon?
    Try quitting the mail app and the launch it again. Try restarting the iPad as well.
    To quit the mail app ....  Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

Maybe you are looking for

  • Format changing when IDCS3 file exported to PDF

    I am using Acrobat 8 version 8.1.2, and InDesign version 5.0.2. I am noticing a very specific problem when exporting some files to PDF from InDesign. We often have a format where we have a numbered list of right-aligned number, followed by some text,

  • After 31.1.2 update cannot view new messages in pane or separate window

    Old messages before today appear, but any message wuht todays date does not appe, the view pane and the message window are blank. How can I move back to previous version until this is fixed?

  • Can not open Console Application

    I am unable to open the console application. I click on it, it bounces in dock, doesn't open and icon disappears. Here is what I could get through terminal on error. Aug 29 12:26:25 USER com.apple.launchd.peruser.1687346633[273] ([0x0-0x4e04e].com.ap

  • UTF8 BOM and iFS problem

    Hi, I have two UTF-8 encoded xml files on a Windows 2000 client and are trying to add them to iFS. The iFS version is 1.1.9.0.7 running of Oracle 8i version 8.1.7.1.1 on an NT4 SP6. I have set IFS_JAVA_VERSION=1.2 to use the Oracle 8i Apache JDK. The

  • Ipod touch sync: other? and restoring questions

    for the past few months everytime i sync my ipod touch it shows the catagorey "other" next to the auido, photos, videos, apps, and free space. at the moment it reads "other 208 MB", which is taking up a lot of my space considering i have an 8GB and i