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: 

Can we upload .XLS file using ws_upload?

Former Member
0 Kudos

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'D:\Quota_upload.xls'

FILETYPE = 'DAT'

TABLES

data_tab = int_input

EXCEPTIONS

conversion_error = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

others = 7.

it's not Retrieving records.

Message was edited by:

megha waykar

Message was edited by:

megha waykar

11 REPLIES 11

ferry_lianto
Active Contributor
0 Kudos

Hi,

Yes, you can ... please try this.


CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'D:Quota_upload.xls'                "Change here with quote
FILETYPE = 'DAT'
TABLES
data_tab = int_input
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
others = 7.

Next time, please use FM GUI_UPLOAD as WS_UPLOAD is obsolete.

Regards,

Ferry Lianto

0 Kudos

Ya I have already given that quotes,then also it's not working

Former Member
0 Kudos

Use GUI_UPLOAD with

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

*reward if solved*

0 Kudos

Not working. I tried that also.

0 Kudos

try giving the file type as <b>DBF</b> and try

0 Kudos

still not working with file type = 'DBF'

Former Member
0 Kudos

check if the filename in D drive is same as written in code

check if the fields declared in internal table are all CHAR types and in same order as in excel file

Former Member
0 Kudos

hi,

u cant do this directly

u have to convert the xls into a tab delimted file in windows by saving as tab delimted.

then u can use GUI_UPLOAD

0 Kudos

Hi sreejith ,this is working,but i having only 2 records into XLS file also into that TXT file and in internal table it is showing 10 records. after 2nd record all 8 records are blank.

Message was edited by:

megha waykar

Message was edited by:

megha waykar

Former Member
0 Kudos

use FM

ALSM_EXCEL_TO_INTERNAL_TABLE

hope this helps

check in the WIKI section in abap generl u will find this

Former Member
0 Kudos

data p_fname10 as string.

assign the path to the variable

and follow the below

CALL FUNCTION 'GUI_upload'

EXPORTING

  • BIN_FILESIZE =

FILENAME = P_FNAME10

  • FILETYPE = 'ASC'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE

  • SHOW_TRANSFER_STATUS = ABAP_TRUE

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ITAB_DATA

  • FIELDNAMES =

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.