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: 

DATA MISSING WHILE USING gui_download

vallamuthu_madheswaran2
Active Contributor
0 Kudos

Hi Genius,

I'm getting data from DB table(BSIS & BKPF) and downloading in excel using GUI_DOWNLOAD.

some data is missing in that excel. I checked it in debugging mode. before executing the FM the internal table has 44157 data.

after downloading the XL has 43708 data. how to solve it. the FM is given below

DATA: lv_file TYPE string.

CONCATENATE full_path '.xls' INTO lv_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = lv_file

filetype = 'ASC'

append = 'X'

write_field_separator = 'X'

confirm_overwrite = 'X'

TABLES

data_tab = gt_main

fieldnames = i_final

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.

Thanks & Regards,

Vallamuthu.M

Edited by: vallamuthu madheswaran on Mar 12, 2010 3:44 PM

Edited by: vallamuthu madheswaran on Mar 12, 2010 3:44 PM

6 REPLIES 6

former_member233090
Active Contributor
0 Kudos

hi,

just check this program and compare with ur program ,



REPORT ZDOWNLOAD.
DATA: lo_gui TYPE REF TO cl_gui_frontend_services,
lv_title TYPE string,
lv_folder TYPE string,
lv_dir TYPE string,
v_filetype TYPE string,
v_filename TYPE string,
lv_filename type string.

DATA:
BEGIN OF ITAB OCCURS 0,
PLNTY TYPE PLKO-PLNTY,
WERKS TYPE PLKO-WERKS,
KTEXT TYPE PLKO-KTEXT,
END OF ITAB.

SELECTION-SCREEN BEGIN of BLOCK layar2 WITH FRAME TITLE judul2.
PARAMETER P_file like RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK layar2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f_browse CHANGING p_file.

START-OF-SELECTION.

PERFORM Z_CONVERT_EXCEL.

form f_browse CHANGING fc_file.
DATA: lo_gui TYPE REF TO cl_gui_frontend_services,
lv_title TYPE string,
lv_folder TYPE string,
lv_dir TYPE string.

CREATE OBJECT lo_gui.
lv_title = 'Define download location'.
lv_folder = 'C:'.
CALL METHOD lo_gui->directory_browse
EXPORTING
window_title    = lv_title
initial_folder  = lv_folder
CHANGING
selected_folder = lv_dir.
fc_file = lv_dir.

endform.

FORM Z_CONVERT_EXCEL .

"This part of code to add column name in the downloaded file.

data : begin of int_head occurs 0,
Filed1(20) type c,                     " Header Data
end of int_head.

int_head-Filed1 = 'PLTNY'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'WERKS'.
APPEND int_head.
CLEAR int_head.

int_head-Filed1 = 'KTEXT'.
APPEND int_head.
CLEAR int_head.

Select plnty werks ktext from plko into CORRESPONDING FIELDS OF TABLE itab
Where plnty = 'Q' .

v_filetype = '.xls'. "I just manipulate the file name using XLS file type.
v_filename = p_file.
CONCATENATE p_file v_filetype INTO lv_filename.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename                = lv_filename
filetype                = 'ASC'
write_field_separator   = 'X'
TABLES
data_tab                = ITAB
FIELDNAMES              = int_head
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.

IF sy-subrc <> 0.

ENDIF.
ENDFORM.

Edited by: Bhavana Amar on Mar 12, 2010 11:56 AM

vallamuthu_madheswaran2
Active Contributor
0 Kudos

Is there any other function module.

Thanks & Regards,

Vallamuthu.M

Former Member
0 Kudos

Hi..

Download the file as .txt, all the records will be downloaded.

CONCATENATE full_path '.txt' INTO lv_file.

arun

0 Kudos

Tested but this is also not working.

Thanks & Regards,

Vallamuthu.M

vallamuthu_madheswaran2
Active Contributor
0 Kudos

SOLVED MYSELF. IF THERE IS ANY SPECIAL CHARACTERS IN TEXT FIELD IT WONT DOWNLOAD THAT PARTICULAR LINE.

0 Kudos

Hi ,

Can you tell me how you have reloved this issue.I am also facing the same problem while downloading the

internal table data into excel sheet using GUI_DOWNLOAD ....when the system finds some special character

the line is got deleted from the excel sheet.