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: 

regarding downloading data into excel from internal table

Former Member
0 Kudos

hi all ,

i'm using the function module SAP_CONVERT_TO_XLS_FORMAT to download data of internal table into excel . now i need to know . when user presses the button for downlading it should download after downloading if he again tries to download it in the same should not allow him to download or it should refresh the excel of the speecific path and then it should downlaod . please let me know how make it.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

U need to define a flag to be set after downloading the data, so if the value of the flag is equal to X, u avoid a new download and if the user refresh the data, u clear the flag in order to allow a new download.

Max

10 REPLIES 10

former_member386202
Active Contributor
0 Kudos

Hi,

Use below FM

call function 'MS_EXCEL_OLE_STANDARD_DAT'

exporting

file_name = p_file " path offile where u need to download

  • CREATE_PIVOT = 0

  • DATA_SHEET_NAME = ' '

  • PIVOT_SHEET_NAME = ' '

  • PASSWORD = ' '

  • PASSWORD_OPTION = 0

tables

  • PIVOT_FIELD_TAB =

data_tab = <dyn_table> "internal table with data

*fieldnames = int_head "internal table with header

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.

Regards,

Prashant

Former Member
0 Kudos

Hi,

See this thread.

Thanks

Former Member
0 Kudos

Hi

U need to define a flag to be set after downloading the data, so if the value of the flag is equal to X, u avoid a new download and if the user refresh the data, u clear the flag in order to allow a new download.

Max

Former Member
0 Kudos

Hi...

validate the file path which the user has entered........this will solve your problem......

If the file is already present you can delete it.. using the method

cl_gui_frontend_services=>file_delete

Cheers

0 Kudos

hi ,

cl_gu_frontend_service is not working as u said .. can u say any alternative method . please let me nkow . Thanks

0 Kudos

well....

whats the problem which you are gettin with cl_gui_frontend_services=>file_delete...

0 Kudos

You can use the following methods to check if a file already exists & delete.

(CL_GUI_FRONTEND_SERVICES)

FILE_DELETE - Deletes a File

FILE_EXIST - Checks if a File Exists

0 Kudos

hi can u say what was the changing parametr RC does . please let me know . thanks

0 Kudos

Hi..

RC is used to raise exceptions.. like FILE NOT FOUND... or ACCESS DENIED.. or SHARING_VIOLATION etc.....

Cheers

0 Kudos

hi muthu kumar ,

in cl_gui_frontend_service file_exist not found .. Please can u say the alternative ...