cancel
Showing results for 
Search instead for 
Did you mean: 

How to download all data from BOL Collection

Former Member
0 Kudos

Hi Experts,

How to download all data from BOL Collection into '*.xls' into local computer drive.

I am using this code but it is not working...


FORM file_creation .


CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
 EXPORTING
   DATE_INTERNAL                  = SY-DATUM
 IMPORTING
   DATE_EXTERNAL                  = lv_date
 EXCEPTIONS
   DATE_INTERNAL_IS_INVALID       = 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.


  CONCATENATE lv_date '.xls' INTO  lv_filename.
   CALL METHOD cl_gui_frontend_services=>gui_download
    EXPORTING
*              bin_filesize              =
      filename                  =  lv_filename "'ABC.als'
*              filetype                  = 'ASC'
      append                    = 'X'
      write_field_separator     = 'X'
*              header                    = '00'
*              trunc_trailing_blanks     = SPACE
*              write_lf                  = 'X'
*              col_select                = SPACE
*              col_select_mask           = SPACE
*              dat_mode                  = SPACE
*              confirm_overwrite         = SPACE
*              no_auth_check             = SPACE
*              codepage                  = SPACE
*              ignore_cerr               = ABAP_TRUE
*              replacement               = '#'
*              write_bom                 = SPACE
*              trunc_trailing_blanks_eol = 'X'
*              wk1_n_format              = SPACE
*              wk1_n_size                = SPACE
*              wk1_t_format              = SPACE
*              wk1_t_size                = SPACE
*              show_transfer_status      = 'X'
*              fieldnames                =
*              write_lf_after_last_line  = 'X'
*            IMPORTING
*              filelength                =
    CHANGING
      data_tab                  = gt_but000_download
    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
          .
  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.                    " FILE_CREATION

It is giving error '   not_supported_by_gui  ' .Is there any solution??????

Best Regards,

Vishal

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Vishal,

You can find the procedure here:

If you don't have htm file, you may include the javasript inside the code itself.

[http://wiki.sdn.sap.com/wiki/display/CRM/DownloaddatafromwebuitoExcelandPPT|http://wiki.sdn.sap.com/wiki/display/CRM/DownloaddatafromwebuitoExcelandPPT]

If you have this data in a table view, you have the option to download it to excel. This option is already provided by the framework.

You can set the following attribute in htm.

downloadToExcel       = "TRUE"

Regards

Leon

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you very much Leon & Prameela,

I am working on a project and my requirement is to put one button for *.xls and one button for *.csv file, i.e. all records should be downloaded in these file and also as LEON said


downloadToExcel       = "TRUE"

this should be ( as client requirement ) like


downloadToExcel       = "FALSE"

i.e. file should be downloaded only through the button. I am very near to my requirement and I am trying. If you have any idea then please help me.

Regards,

Vishal.

Former Member
0 Kudos

Hi vishal,

Try this Class methods..


CL_GUI_FRONTEND_SERVICES

Regards,

VIJAY

Former Member
0 Kudos

Hi Vijay,

Thank you very much for your reply, but methods of CL_GUI_FRONTEND_SERVICES is not supported by CRM WEB UI.

Thanks,

Vishal

0 Kudos

Hi Vishal,

CRM WebClient framework doesn't support your specific requirement.

The best approach would be, you can add separate buttons and provide

javascript coding to handle the 2 differenct scenarios.

Refer: [http://wiki.sdn.sap.com/wiki/display/CRM/DownloaddatafromwebuitoExcelandPPT|http://wiki.sdn.sap.com/wiki/display/CRM/DownloaddatafromwebuitoExcelandPPT]

Regards,

Leon

Former Member
0 Kudos

Hi Vishal,

Directly if u want to download data from BOL into excel sheet , there is one option "Export to Spread sheet" in result view if it is config table.

Regards

Prameela