01-28-2008 5:26 PM
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?
01-28-2008 5:33 PM
01-28-2008 5:58 PM
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
01-28-2008 6:05 PM
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?
01-29-2008 6:51 PM
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
01-30-2008 2:11 PM
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.
01-31-2008 12:41 PM
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
01-31-2008 12:51 PM
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
01-31-2008 12:58 PM
In the case of back ground schedule programs ur requirement is only possible by using open dataset and close dataset
01-31-2008 2:37 PM
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.