‎2005 Oct 25 11:00 AM
i already know how to upload excel file from local pc can anyone tell me how to upload excel file from the application server??
‎2005 Oct 26 4:18 AM
Hi Sharad,
Excel file cannot be uploaded from application server unless it is converted to a text file. Excel file is belongs Windows OS and Application server will be either in Unix or Informix etc. Text file is the only compatible format across all the platform and so excel file should be changed to the common format. Hope this helps.
Regards,
Kasthuri Rangan.
‎2005 Oct 25 11:12 AM
Function module KCD_EXCEL_OLE_TO_INT_CONVERT will allow you to do this.
‎2005 Oct 25 11:20 AM
Hi,
Try this one
Retrieve Data file from Application server
DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.
OPEN DATASET i_file FOR INPUT IN TEXT MODE.
IF sy-subrc NE 0.
MESSAGE e999(za) WITH 'Error opening file' i_file.
ENDIF.
DO.
* Reads each line of file individually
READ DATASET i_file INTO wa_datatab.
* Perform processing here
* .....
ENDDO.you may Refer to yhese links too: http://www.sapdevelopment.co.uk/file/file_updown.htm
http://www.sapdevelopment.co.uk/file/file_uptabsap.htm
OR
try this one
FM: UPLOAD_FILES
Regards,
Amit
‎2005 Oct 25 12:03 PM
Hi,
You can use:
OPEN DATASET v_file FOR INPUT IN TEXT MODE.
Where:
v_file LIKE FILENAME-FILEINTERN, "File name
Best Regards,
Anjali
‎2005 Oct 25 11:11 PM
If you have access to the application server, then you can do it the same way as you do on your local PC.
If not, try using OPEN/READ/CLOSE dataset in BINARY MODE.
Check out the SAP help files on this.
‎2005 Oct 26 4:18 AM
Hi Sharad,
Excel file cannot be uploaded from application server unless it is converted to a text file. Excel file is belongs Windows OS and Application server will be either in Unix or Informix etc. Text file is the only compatible format across all the platform and so excel file should be changed to the common format. Hope this helps.
Regards,
Kasthuri Rangan.
‎2005 Oct 26 11:30 AM
can the conversion of excel file into .txt format can be done internally through ABAP?
‎2005 Oct 26 11:43 AM
Sharad,
I found this to be the easiest way to handle Excel files on the server.
types : begin of ty_filestructure,
row(500) type c,
end of ty_filestructure.
data : i_filedata type standard table of ty_filestructure
with header line.
data: l_fnam like rlgrap-filename,
l_filedata type kcde_intern,
l_fileline like line of l_filedata,
l_col type kcd_ex_col_n.
l_fnam = p_fnam.
pick up the sheet of the workbook that has the focus
call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
exporting
filename = l_fnam
i_begin_col = 1
i_begin_row = 1
i_end_col = 50
i_end_row = 2500
tables
intern = l_filedata
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message i000(38)
with 'Error loading data - return code'
sy-subrc.
exit.
endif.
create real table rows from l_filedata; pull back empty cells as
well as populated ones
loop at l_filedata into l_fileline.
l_col = l_col + 1.
if l_fileline-col = l_col.
concatenate i_filedata
l_fileline-value
into i_filedata
separated by c_comma.
else.
while l_col < l_fileline-col.
concatenate i_filedata
space
into i_filedata
separated by c_comma.
l_col = l_col + 1.
endwhile.
concatenate i_filedata
l_fileline-value
into i_filedata
separated by c_comma.
endif.
at end of row.
shift i_filedata left deleting leading c_comma.
append i_filedata.
clear i_filedata.
clear l_col.
endat.
endloop.
Margaret.