06-27-2007 9:37 AM
Hi Experts, I need a FM to search a file into a directory of a PC. The class cl_gui_frontend_services is not good for me because i don´t execute ths SAP GUI, I´m conecting with SAP via WEB.
Thanks.
06-27-2007 9:45 AM
you shoul use html code
<input type="file" that will automatically bring the file browse button
06-27-2007 9:49 AM
Thanks but I need to know if a file exists in a PC but from a FM in SAP.
06-27-2007 9:57 AM
i dont know of a FM which can work from web. but you can do this (checking whether file exists in users comupter) using javascript file system object.
check this link for sample code
http://www.codeproject.com/useritems/JavaScript__File_Handling.asp
06-27-2007 10:09 AM
thanks, but I only need a FM to search a file into a PC that not use the GUI.
06-27-2007 10:13 AM
Hi,
The function module 'RZL_READ_DIR_LOCAL' can be used to retrieve the files in the application server directory.
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
NAME =
TABLES
FILE_TBL =
EXCEPTIONS
ARGUMENT_ERROR = 1
NOT_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Aparna
06-27-2007 10:20 AM
Thanks. I'm trying with this FM and a file stored in my C: and the result is bad.
Do you have an example??
06-27-2007 10:35 AM
06-27-2007 10:37 AM
Hi Jorge,
try this:
DATA: LV_CNT TYPE I,
LS_FILENAME TYPE FILE_TABLE,
LT_FILENAME TYPE FILETABLE.
*
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = 'C:\'
FILTER = '.'
FILES_ONLY = 'X'
CHANGING
FILE_TABLE = LT_FILENAME
COUNT = LV_CNT.
*
LOOP AT LT_FILENAME INTO LS_FILENAME.
WRITE: / LS_FILENAME.
ENDLOOP.
Regards, Dieter
06-27-2007 11:18 AM
06-27-2007 11:21 AM
you are working on webfrontend and all these classes and FMs mentioned here wont work without SAPgui (are you working on BSP?)
you have to follow the approach given in the link i had provided
http://www.codeproject.com/useritems/JavaScript__File_Handling.asp
06-27-2007 11:21 AM
Hi Jorge,
can you explane why this CLASS isn't good for you?
Does this class exist?
Which release do you have.
Regards, Dieter
Hi,
forget my question, i see it in your thread
Sorry.
regards, Dieter
Message was edited by:
Dieter Gröhn
06-27-2007 11:28 AM
06-27-2007 11:32 AM
ABAP or JAVA webdynpro?
whatever be the case, i would suggest you to post the question either in java webdynpro or abap webdynpro forum for a quicker response.
Raja
06-27-2007 12:09 PM
06-27-2007 12:14 PM
i am not a java expert, but to handle client machine file system from java apps. you should use something like
if ( new java.io.File("C:\test.txt").exists() ) ...
for more on this check this link
06-27-2007 11:31 AM
Hi,
try this:
data:c_x type c value 'X'.
selection-screen begin of block blk1 with frame title text-000.
parameters : p_file type localfile obligatory,
selection-screen end of block blk1.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = c_x
mask = text-013
changing
file_name = p_file
exceptions
mask_too_long = 1
others = 2.
if sy-subrc <> 0.
do nothing
endif.
regards,
Sooness
06-27-2007 11:31 AM