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

upload data from Excel to internal table without using Screen

Former Member
0 Likes
508

Hi,

My reqirment is to read the excel input data and then upload it to internal table for further proceeing but without using selection input screen. I mean can I mention the fixed file name and the path in the function module iself for the input file.

3 REPLIES 3
Read only

Former Member
0 Likes
467

You can use FM ALSM_EXCEL_TO_INTERNAL_TABLE. Here you can mention file name in the importing parameter 'FILENAME'. I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
467

Use this Fm: ZRFC_EXCEL_TO_INTERNAL_TABLE

Read only

Former Member
0 Likes
467

1.First create one internal table as u have created ur EXCEL file.

e.g: if ur EXCEL file contains 3 fields col1 col2 and col3.

data: begin of wa,

col1(10),

col2(10),

col3(10),

end of wa,

itab like standard table of wa.

data: filename type string 'C:\FOLDER\DATA.XLS'

If u dont want to use the screen, then pass the file name directly to the GUI_UPLOAD FM.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = filename

FILETYPE = '.XLS'

tables

data_tab = itab

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.

This will serve ur puspose.

loop at itab into wa.

write: / wa-col1,wa-col2,wa-col3.

endloop.

Thanks & Regards

Santhosh