Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem While downloading Report to Excel

Former Member
0 Kudos

Hi all,

I had used function module GUI_DOWLOAD for downloading the excel to a file specified in the path.While executing its working fine and downloading the file to excel.But while runnijg it in the background the Excel file is not getting saved to the specifie path.Can anyone tell me a solution.

Please reply.

Thanks in Advance

Nitin

16 REPLIES 16

Former Member
0 Kudos

GUI_download doesnot support download functionality in background.

0 Kudos

GUI FM cant run in BG look for another FM

Former Member
0 Kudos

This function does not work in background mode, only foreground (GUI...).

Use open dataset commands instead.

Edited by: Shmilo on Mar 17, 2009 10:25 AM

Former Member
0 Kudos

Hi,

YOu cannot use GUI function modules in background

Regards

Former Member
0 Kudos

Hi,

Thanks to all fo rthe reply.

Then can anyone tell which function module to use instead.

Thanks

Nitin

0 Kudos

Better you use OPEN DATASET... and write the data in Application server.

Or create Spool when executed in Background. Which you can download later from SP01.

Former Member
0 Kudos

Hi,

GUI_DOWNLOAD FM will not support in background mode.

Otherwsie use OPEN DATASET and write the data in the application server.

And also check is there any other FM's.

0 Kudos

PLease use this function module to perform the required task

'SAP_CONVERT_TO_XLS_FORMAT', If you are using any other function modules all the data will go into the A1 cell and not as the structure of the internal table.

This is a standard FM that will write in the structure of the Itable.

ChK

Edited by: Harsha Cheruku on Mar 17, 2009 10:43 AM

Edited by: Harsha Cheruku on Mar 17, 2009 10:43 AM

Former Member
0 Kudos

hi,

Try Using this , ie class interface.

cl_gui_frontend_services=>gui_download

Thanks and Regards

Suraj

Former Member
0 Kudos

Hi Nitin ,

In this context, we can also use OLE to save the excel file including various cell formating actions.

Regards,

Nitin Sikka.

Former Member
0 Kudos

Hi,

You cannot write data to Presentation Server while executing the program in the background,

GUI_DOWNLOAD will not work.

So your option is to write a file on the app server, which can be done by OPEN DATASET.

(OR)

There is no way to do it as a background job.. create the folder..

transfer the file to the appliaction server in the backgorund using OPEN DATASET...

use the tcode CG3Y to download the file from the app server to your folder..

Regards,

Shalini

Former Member
0 Kudos

GUI_DOWNLOAD will not work for downloading the report into Excel in background.

You can try this code,

DATA : l_mess(200).

DATA : i_tab LIKE text1.

OPEN DATASET <Path> FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE l_mess.

IF sy-subrc NE 0.

MESSAGE w_msg TYPE 'S' DISPLAY LIKE 'E'.

LEAVE LIST-PROCESSING.

ENDIF.

DO.

READ DATASET w_path INTO i_tab.

IF sy-subrc EQ 0.

i_tab2 = i_tab.

APPEND i_tab2.

CLEAR i_tab2.

ELSE.

EXIT.

ENDIF.

ENDDO.

CLOSE DATASET w_path.

Regards,

Joan

Former Member
0 Kudos

Hi all,

Thanks a lot .

I will try by using OPEN DATASET n revert back.

Thanks once more.

Nitin

0 Kudos

HI Nitin,

GUI_DOWNLOAD FM is not supported in forground.

Better you use OPEN DATASET... and write the data in Application server.

Or if you are generating a List then it will create Spool when executed in Background. Which you can download later from SP01.

Regards,

Nitin.

Former Member
0 Kudos

Hi Nitin,

You can do like this,



TYPE-POOLS: slis,truxs.


DATA: it_upload TYPE STANDARD TABLE OF i_upload,      "internal table having uploaded file data
      wa_upload LIKE LINE OF it_upload.

DATA: it_raw TYPE truxs_t_text_data.                  "internal table declared to be passed in the
                                                                          "function module used to convert data from 
                                                                           "xls to sap

START-OF-SELECTION.
  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
      i_field_seperator    = 'X'
      i_line_header        = 'X'
      i_tab_raw_data       = it_raw
      i_filename           = p_file
    TABLES
      i_tab_converted_data = it_upload[]
    EXCEPTIONS
      conversion_failed    = 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.


Hope it helps

Regards

Mansi

Former Member
0 Kudos

Hi all,

reagrding the dowloading of ALV to excel in bacjground some one suggested me to use FM 'EXCEL_OLE_STANDARD_DAT' ..how far this will help is my problem,ie dowloading not occuring while executing in Background.

Thanks,

Nitin