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
357

Hey Folks,

I need to convert the excel data into inernal table

types : begin of ty_data,

matnr type matnr,

exbwr type exbwr,

text type c,

end of ty_data.

This is my excel file.

6249 10 prabhas

6249 56 Dude

6249 57 Rockstar

6249 80 Babu

6249 90 Bhaiyya

6249 250 Munna

6249 35 Rocky

6249 75 Hero

6249 789 Prankster

-


data : filename type string.

filename = p_file.

call function 'GUI_UPLOAD'

exporting

filename = filename

FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = it_data

  • 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.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

when I m using this FM i m getting the error as Bad_DATA_FORMAT i have also checked the FM ALSM_EXCEL_INTERNAL_TABLE but both seems not to be working in my case. Can somebody tell me where its gong wrong.

Thanks

Rock

2 REPLIES 2
Read only

Former Member
0 Likes
332

try to convert/save the excel file into tab delimited text file, and then try using GUI_UPLOAD

call function 'GUI_UPLOAD'

exporting

filename = filename

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X' "<---use this

Read only

Former Member
0 Likes
332

Have you looked at using FM ALSM_EXCEL_TO_INTERNAL_TABLE?