‎2009 Feb 05 11:49 AM
Hi all,
I have a requirement where in a number of documents (.doc,pdf,xls,txt...etc) are placed in a fixed folder in C drive .
i have to upload these documents to application server.
The problem here is how to read the file names with file type through a normal report program.
Help me plz .....
thanks in advance.
‎2009 Feb 05 11:52 AM
Hi,
Use CG3Z transaction code to uplaod ur files to application server.
Regards,
Nagaraj
‎2009 Feb 05 11:51 AM
Hi,,
You can upload XLS USING
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
CALL FUNCTION 'TEXT_CONVERT_PDF_TO_SAP'
TXT
CALL FUNCTION 'GUI_UPLOAD'
Thanks
Arun Kayal
‎2009 Feb 05 11:52 AM
Hi,
Use CG3Z transaction code to uplaod ur files to application server.
Regards,
Nagaraj
‎2009 Feb 05 11:59 AM
hi nagaraj,
thanks for ur timely reply.
As u said we can upload the files using CG3Z , yes we can
but the problem here is i donno the file names which are to be uploaded
‎2009 Feb 05 12:16 PM
Use Class CL_GUI_FRONTEND_SERVICES
Methods DIRECTORY_LIST_FILES to get file attributes
data: v_dir_path type string.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = v_dir_path
FILTER = '.'
FILES_ONLY =
DIRECTORIES_ONLY =
CHANGING
FILE_TABLE = v_files
COUNT = v_count
EXCEPTIONS
CNTL_ERROR = 1
DIRECTORY_LIST_FILES_FAILED = 2
WRONG_PARAMETER = 3
ERROR_NO_GUI = 4
NOT_SUPPORTED_BY_GUI = 5
others = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2009 Feb 05 11:55 AM
HI BRO....
for TXT/BIN use
CALL FUNCTION 'GUI_UPLOAD'
for PDF use
CALL FUNCTION 'TEXT_CONVERT_PDF_TO_SAP'
for XLS use
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
REGARDS.
‎2009 Feb 05 11:55 AM
hi,
FM text_convert_xls_sap. for excel sheet
FM gui_upload for text file
example code
OPEN DATASET w_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT t_bkpf INTO fs_bkpf.
CONCATENATE fs_bkpf-bukrs
fs_bkpf-belnr
fs_bkpf-gjahr
fs_bkpf-blart
fs_bkpf-bldat
INTO line
SEPARATED BY space
IN CHARACTER MODE .
TRANSFER line TO w_file.
CLEAR line.
ENDLOOP.
This way a file from presentation server can be uploaded to application server
‎2009 Feb 05 11:58 AM
Hi,
Read the length of the string first as shown below
data : v type i,
abc1 type c.
parameter : p_abc like filetype.
v = strlen(p_abc).
v = v - 3.
abc = p_abc+v(3).
translate abc in uppercase.
if abc = 'XLS'
use the excel reading function module.
elseif abc = 'PDF'.
use the respective function modules.
etc.
Regards,
Naresh
‎2009 Feb 05 12:03 PM