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

Problem with GUI_UPLOAD

Former Member
0 Likes
1,108

HI Experts,

I am uploading data from a .csv file and the internal table i am using for storing the data is as below:

TYPES : BEGIN OF t_file ,

data(360),

END OF t_file.

DATA : i_file TYPE TABLE OF t_file,

wa_file TYPE t_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_path

filetype = 'ASC'

  • has_field_separator = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

IMPORTING

FILELENGTH = file_lth

  • HEADER =

TABLES

data_tab = i_file

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17

And the problem is , for every record only the first 132 characters are getting uploaded and rest of the record is getting truncated.

Regards,

Praveen.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,030

Hi Praveen,

Just go through the following link:

Hope this will help.

Regards,

Nitin.

8 REPLIES 8
Read only

Former Member
0 Likes
1,031

Hi Praveen,

Just go through the following link:

Hope this will help.

Regards,

Nitin.

Read only

Former Member
0 Likes
1,030

Hello,

Try in this way it is working fine.

types: begin of y_t_in_out,

record type char8000 ,

end of y_t_in_out.

data: y_i_tab_in type table of y_t_in_out,

data y_pv_fname type string.

constants: y_lc_asc type char10 value 'ASC'.

call function 'GUI_UPLOAD'

exporting

filename = y_pv_fname

filetype = y_lc_asc

tables

data_tab = y_i_tab_in

exceptions

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

others = 17.

Read only

0 Likes
1,030

Hi santosh,

I tried as u said...but the same problem is occuring...its is accepting only 132 chars.

Read only

Former Member
0 Likes
1,030

Hi,

Then try this one out: [use cl_gui_frontend_services instead of GUI_UPLOAD]

DATA:

lv_title TYPE string,

lv_filter TYPE string,

lv_ext TYPE string,

lv_rc TYPE i,

li_selfiles TYPE STANDARD TABLE OF file_table,

lv_action TYPE i.

lv_title = 'Open File'.

lv_filter = 'Comma-Separated (CSV) file (.csv)|.csv|'. " HERE 'Comma-Separated (CSV) file'

" part is for comment [understanding purpose] and '(.csv)|.csv|' must be passed.

lv_ext = 'csv'.

call method cl_gui_frontend_services=>file_open_dialog

EXPORTING

WINDOW_TITLE = 'TEST'

DEFAULT_EXTENSION = lv_ext

  • DEFAULT_FILENAME =

FILE_FILTER = lv_filter

"This parameter could be used to capture any particular extention [eg, TXT or CSV or anything]

  • WITH_ENCODING =

  • INITIAL_DIRECTORY =

  • MULTISELECTION =

changing

file_table = li_selfiles

rc = lv_rc

USER_ACTION = lv_action

  • FILE_ENCODING =

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5

.

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 this helps.

Read only

Former Member
0 Likes
1,030

Hi praveen,

Have you tried the code that i have posted? still it is not coming?

Read only

0 Likes
1,030

Hi,

I tried to implement it, but where are v going to pass the file path like we do it in GUI_UPLOAD for the file to be uploaded .

Read only

0 Likes
1,030

THanks i found the ans myself.Its nothing but during debugging the field shows only 132 chars but internally the entire content will be there.

Read only

Former Member
0 Likes
1,030

solved