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: 

gui_upload issue

Former Member
0 Kudos

Hi All,

I am using GUI_UPLOAD as shown below to upload data from from front end using an excel file,

but i am getting some junk data into the internal table,please solve this and i need to use GUI_UPLOAD only.

DATA: I_TEMP_FILE TYPE STRING.

MOVE P_FILE TO I_TEMP_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = I_TEMP_FILE

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = IT_MASTER

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.

IF SY-SUBRC = 0.

ENDIF.

Thanks,

Kumar

9 REPLIES 9

former_member191735
Active Contributor
0 Kudos

Make sure your internal table has same no.of.fields that you have in your file.

former_member191735
Active Contributor
0 Kudos

or try using 'BIN' instead of ASC

Former Member
0 Kudos

Kumar,

Check your Fields in flat file & fields in internal table are in the same order.

Regards,

Satish

Former Member
0 Kudos

Hi Kumar,

HAS_FIELD_SEPARATOR = 'X'

Please chek this condition. and check your flat file for the field seperator.

Thanks

Pavan

Former Member
0 Kudos

Hi Kumar,

Did you find a solution to this issue,

I am also facing the same problem, but my code uses the method GUI_UPLOAD and not the FM,

Would be great if you could let me know the solution,

Appreciate it

lalitha

0 Kudos

as I know you save the xls into a tab delimited or comma seperated file and then try.. Once I had the same problem, this solved my issue.

Former Member
0 Kudos

begin of itab,

raw(255) type x,

end of itab occurs 0.

CALL FUNCTION 'GUI_UPLOAD'

exporting

filetype = 'BIN'

filename = 'C:\File.XLS'

tables

data_tab = itab.

Loop at itab.

SPLIT wa_data

AT cl_abap_char_utilities=>horizontal_tab

INTO

wa_data-field1

wa_data-field2

...................

wa_data-fieldn.

APPEND wa_data_create TO itab_data_create.

endloop.

Hope it helps.

Lokesh

Edited by: Lokesh Aggarwal on Dec 20, 2007 5:40 PM

Former Member
0 Kudos

As suggested, saving XLS files as tab delimted will solve the issue..

If you want to avoid it, use FM

ALSM_EXCEL_TO_INTERNAL_TABLE..

This will upload your Excel in from of Row number, column number and value...you can write a logic to loop at this table and transfer data in structured internal table in your program

former_member386202
Active Contributor
0 Kudos

Hi,

Use FM ALSM_EXCEL_TO_INTERNAL_TABLE instead of GUI_UPLOAD.

Regards,

Prashant