Skip to Content
author's profile photo Former Member
Former Member

download data

hi,

ihave written the following code to download the data to excel.

the download was successfull but i am getting extra columns with zeros

and i need to set default file name as data_sy-datum.

the filename i am not getting which i have set(eg:data_30102008)

please check the below code and sugest me

s_name = sy-datum.

DATA: v_pass_path TYPE string value 'C:\Documents and Settings\latha\Desktop\'.

concatenate v_pass_path s_name into v_file1.

CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'

EXPORTING

default_extension = 'XLS'

IMPORTING

fullpath = v_file1.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = v_file1

filetype = 'DBF'

TABLES

data_tab = GT_FINAL

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 09:08 AM

    Hi,

    Try like this....

    
    DATA: v_pass_path TYPE string value 'C:\Documents and Settings\latha\Desktop\'.
    
    concatenate v_pass_path '_' sy-datum  into v_file1.
    
    CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
    EXPORTING
    default_extension = 'XLS'
    IMPORTING
    fullpath = v_file1.
    
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = v_file1
    filetype = 'ASC'
    TABLES
    data_tab = GT_FINAL
    
    

    Hope it will helps

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 10:48 AM

    Hi Hema,

    Please try the following code.

    
    DATA:BEGIN OF IT_ZSTUDENT OCCURS 0.
         INCLUDE STRUCTURE ZSTUDENT.
    DATA:END OF IT_ZSTUDENT.
    DATA:FNAME type string.
    
    concatenate 'C:\' 'DATA_' sy-datum '.xls' into fname.
    
    SELECT * from zstudent into table it_zstudent up to 5 rows.
    
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = FNAME
       FILETYPE                        = 'ASC'
       WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                        = it_zstudent.
    
    IF SY-SUBRC <> 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    

    Thanks,

    N.K.C

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 10:52 AM

    Hi,

    This code may help u...

      DATA:     w_file_name TYPE string,
                w_full_path TYPE string,
                full_path TYPE string,
                action TYPE i.
    
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = 'ABCD'
          initial_directory    = 'c:\Documents and Settings\2q\Desktop'
          prompt_on_overwrite  = 'X'
          default_extension    = 'XLS'
          default_file_name    = 'ABCD'
        CHANGING
          filename             = w_file_name
          path                 = w_file_path
          fullpath             = full_path
          user_action          = action
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
    
      IF action EQ 0.
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            filename                = w_file_name
            filetype                = 'DAT'
          CHANGING
            data_tab                = <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
            not_supported_by_gui    = 22
            error_no_gui            = 23
            OTHERS                  = 24.
    
    

    Edited by: Sukriti Saha on Oct 30, 2008 4:22 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.