Application Development and Automation 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: 
Read only

gui_download problem .

former_member196299
Active Contributor
0 Likes
878

Hi All ,

I am facing a problem while downloading an itab to an excel file using GUI_DOWNLOAD .

The problem I face is , if the itab contains 1000 records then only 900 records are getting

downloaded to the .xls file instead of the 1000 itab records .

Kindly give suggestions to solve this issue .

Regards,

Ranjita

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
830

Please Download it as .csv file.

5 REPLIES 5
Read only

Former Member
0 Likes
831

Please Download it as .csv file.

Read only

0 Likes
830

Thanks for the suggestion , but the client want it to be downloaded in .slx format .

Regards,

Ranjita

Read only

Former Member
0 Likes
830

Hi,

Please try OLE for downloading to XLS. A sample is given below:

DATA : w_excel TYPE ole2_object,

w_wbook TYPE ole2_object,

w_wbooklist TYPE ole2_object,

w_appl TYPE ole2_object,

w_sheet TYPE ole2_object.

CREATE OBJECT w_excel 'EXCEL.APPLICATION'.

GET PROPERTY OF w_excel 'WORKBOOKS' = w_wbooklist.

GET PROPERTY OF w_wbooklist 'APPLICATION' = w_appl.

SET PROPERTY OF w_appl 'SHEETSINNEWWORKBOOK' = 1.

CALL METHOD OF w_wbooklist 'ADD' = w_wbook.

GET PROPERTY OF w_appl 'ACTIVESHEET' = w_sheet.

CALL METHOD cl_gui_frontend_services=>clipboard_export

IMPORTING

data = i_exceltab

CHANGING

rc = l_rc

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

CALL METHOD OF w_sheet 'PASTE'.

ENDIF.

CALL METHOD OF w_excel 'QUIT'.

FREE OBJECT : w_excel, w_wbooklist, w_appl, w_wbook, w_sheet.

Thanks,

Renjith.

Read only

Former Member
0 Likes
830

Sorry, i missed one small part.

CALL METHOD OF w_wbook 'SAVEAS'

EXPORTING

#1 = l_fullpath

#2 = 1.

This is to be used after CALL METHOD OF w_sheet 'PASTE'.

Thanks,

Renjith.

Read only

Former Member
0 Likes
830

Hi ,

DATA L_P_FILE TYPE STRING.

L_P_FILE = P_FILENM.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = L_P_FILE

FILETYPE = u2018DATu2019 <----


Try changing 'ASC' here

TABLES

DATA_TAB = L_ITAB <----- Your internal table

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.