2007 Oct 04 12:55 PM
Hi,,
how to validate the logical path entered on the selection screen.
2007 Oct 04 12:57 PM
At selection-screen on p_field.
try.
opendataset p_field text mode encoding default.
if sy-subrc NE 0.
<< throw error message>>
endif.
endtry.
2007 Oct 04 1:00 PM
There r two ways -
1. Use this FM and check the Filename entered on screen with the populated table.
CALL FUNCTION 'RZL_READ_DIR'
EXPORTING
name = directory
nrlines = 1
TABLES
file_tbl = file_table
EXCEPTIONS
argument_error = 1
not_found = 2
send_error = 3
OTHERS = 4.
2. Use open Dataset
open dataset d1........
if sy-subrc <> 0.
write:/ 'File path not found'.
endif.
try this FM also.
DX_FILE_EXISTENCE_CHECK
Regards,
Amit
Reward all helpful replies.
2007 Oct 04 1:00 PM
Hi,
Use the Fucntion module FILE_GET_NAME to Retrieve Logical file path.
For example, look at the below code
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db95e635c111d1829f0000e829fbfe/content.htm
Regards
Sudheer
2007 Oct 04 1:02 PM
Hi,
check the piece of code..
*--Call the function module to get the physical file name for the
logical file path provided.
DATA: lv_mandt LIKE sy-mandt,
lv_opsys LIKE sy-opsys.
MOVE: sy-mandt TO lv_mandt,
sy-opsys TO lv_opsys.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
client = lv_mandt
logical_filename = p_lpn
operating_system = lv_opsys
IMPORTING
file_name = v_fname1
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
File not found.
MESSAGE i137.
LEAVE LIST-PROCESSING.
ENDIF.
reward if helpful..
Regards,
Nagaraj
2007 Oct 04 1:20 PM
sorry,,,
i have to validate the physical path entered by the user not logical path..
i can use open dataset..
but if the user enters only directory then also it will give sy-subrc 0.
please tell me how to validate the file.