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: 

Upload XL file into an internal table

Former Member
0 Kudos

Hi,

I need to upload one excel file in my program; though the FM 'TEXT_CONVERT_XLS_TO_SAP' does purpose; it is restricted to be executed only in the foreground mode.

My requirement is to run this in background; is there any other FM that can do it?

9 REPLIES 9

SantoshKallem
Active Contributor
0 Kudos

have u tried with

ALSM_EXCEL_TO_INTERNAL_TABLE function module

Former Member
0 Kudos

HI Sanjay, During background processing u cannot upload data from a Frontend ( Desktop) u Have to upload data from an application server.. So these FM will only upload data from a presentation server.. So, Kindly upload the data using Open Dataset.. and Read Dataset..

Regards,

Swaroop

0 Kudos

Sorry I forgot to mention one point that basically the file is located in the app server....it's not in the front end..the program rather the FM works fine in foreground but doesn't work in back as said..

that's what i was looking for whether we can use some other options or not?

0 Kudos

I think you might have found an answer by now.. However i think when u try to upload an xl file from an application server.. with Read Stmt.. u will get the whole line separated by a special character.. I think "#"... So u can use a split into your workarea. I hope this should work out...

Regards,

Swaroop Patri

0 Kudos

Hi Swaroop,

Thanks for your reply; but the problem is not with reading the file. Let me clarify you. I am using the fm as mentioned my initial thred. The file upload is fine...but the problem is that the FM is having an internal sy-batch check that restrict it to be executed in background.. i haven't got any other function module till now.. that's my issue....so i am looking for whether there is any other fm that does the same purpose (to be executed in background mode) and also to be capable of uploadingthe file from application server.

0 Kudos

Oh ho.. I am not aware of any other FM's for your requirement.. Any ways let me know if you could find some other solution to your problem.

Thanks

Swaroop Patri

Former Member
0 Kudos

Hi,

Check this link

http://www.sapdevelopment.co.uk/file/file_updown.htm

Check this code also



REPORT zztest.

DATA : filename LIKE dxfields-longpath.
DATA : BEGIN OF itab OCCURS 0,
a(200) TYPE c,
END OF itab.


CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = 'A'


I_SERVER = '?' 
I_PATH = 
filemask = '*.xls'

FILEOPERATION = 'R' 
IMPORTING

O_LOCATION_FLAG = 
O_SERVER = 
o_path = filename

ABEND_FLAG = 
EXCEPTIONS
rfc_error = 1
error_with_gui = 2
OTHERS = 3.

OPEN DATASET filename FOR INPUT IN BINARY MODE.
WHILE sy-subrc = 0.
CLEAR itab .
READ DATASET filename INTO itab.
APPEND itab.
ENDWHILE.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'd:\abc.xls'
filetype = 'BIN'
TABLES
data_tab = itab. 

Regards,

Satish

Former Member
0 Kudos

In the case of back ground schedule programs ur requirement is only possible by using open dataset and close dataset

rainer_hbenthal
Active Contributor
0 Kudos

There is no function module available for reading XLS files in the background. SAP does not really read an excel file, they are steering the excel via OLE, transporting tha data finally through the clipboard into SAP and then doing nothing as interpreting the data as a tab dilimted file.

In background mode you dont have a running excel, nor OLE nor a clipboard.

Convert the file to CSV, this is easy to read in and you can split the lines via the split command.