‎2007 Jan 31 5:06 AM
Hi Experts
I am writing a report for uploading and reading a .csv file from the application server.
what function module shd i use for these:
1> Upload file : so that user can searcg the file from application server.
2> Read file : Read the uploaded file .
Regards
Dhanya
‎2007 Jan 31 5:14 AM
Use gui_upload method of CL_GUI_FRONTEND_SERVICES class...
anything you want to do between AS and presentation layer, please use methods of this class...
Regards
Puru
‎2007 Jan 31 5:14 AM
Use gui_upload method of CL_GUI_FRONTEND_SERVICES class...
anything you want to do between AS and presentation layer, please use methods of this class...
Regards
Puru
‎2007 Jan 31 5:16 AM
Thanks puru
May i have the sample code for that. I m new to Abap.
‎2007 Jan 31 5:19 AM
DATA l_file_length TYPE i.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = a_full_filename
filetype = a_filetype
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
read_by_line = 'X'
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
filelength = l_file_length
HEADER =
CHANGING
data_tab = at_stream
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
.
IF sy-subrc > 0.
CALL METHOD me->handle_up_download_error
EXPORTING
im_subrc = sy-subrc
im_download = space
im_called_method = 'CL_APL_ECATT_EXT_DATA->UPLOAD_CALL'
IM_PREVIOUS =
.
ENDIF.
If you want more example.. Just use Where-used for GUI_UPLOAD method.. There will more than 10 examples on each server for this.
‎2007 Jan 31 5:18 AM
Refer this link
http://www.sapdevelopment.co.uk/file/file_updown.htm
* Retrieve Data file from Application server(Upload from Unix)
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.
‎2007 Jan 31 5:18 AM
Hi Dhanya,
For uploading the file from application server u can use
UPLOAD_FILES function module.
regards ,
Santosh Thorat
‎2007 Jan 31 5:24 AM
hi dhanya,
u can use the fm F4_FILENAME for the user to searcrh for the file
and WS_UPLOAD to upload to the aplication server..
after that u can open and read the file...
folllowing are the links with sample code which can help u
http://abapexample.blogspot.com/
http://www.sap-img.com/ab004.htm
and follow the procedure given above by judith for opening and reading the file
hope this helps u a bit,
all the best,
regards,
sampath
mark helpful answers
‎2007 Jan 31 5:35 AM
Hi Sampath
I think F4_FILENAME for the user to search for the file
and WS_UPLOAD to upload from "Presentation Server".
I m looking for Application Server.
‎2007 Jan 31 5:51 AM
Hi dhanya,
am sorry for that..my mistake..
however try these fm's
EPS_GET_DIRECTORY_LISTING ---puts result into internal table but doesnt prompt...
SAPDMC/LSM_F4_SERVER_FILE --prompts for the selecvtion
hope this helps u a bit,
all the best,
regards,
sampath
mark helpful answers
Message was edited by:
sampath pilla
‎2007 Feb 14 7:35 AM