2007 Jul 03 2:34 PM
hi everybody,
According to requirement selction screen having a file path. If we specify the file location the data is downloaded and stores in the file. How to perfom validation on that file name.
2007 Jul 03 2:41 PM
Use this FM to split file name PC_SPLIT_COMPLETE_FILENAME into filename & extension then check the both as per your requirement.
Regards,
Amit
reward all helpful replies.
Use this FM to split file name PC_SPLIT_COMPLETE_FILENAME into filename & extension then check the both as per your requirement.
Regards,
Amit
reward all helpful replies.
2007 Jul 03 2:36 PM
Hi,
What kind of validation do you want to perform?
Regards,
Vinodh.
2007 Jul 03 2:39 PM
the validations are
1. path validations
2. file name validations
2007 Jul 03 2:46 PM
Hi
try this:
AT SELECTION-SCREEN
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = PATH
CHANGING
FILE_TABLE = FILE_TABLE
COUNT = COUNT
EXCEPTIONS
CNTL_ERROR = 1
DIRECTORY_LIST_FILES_FAILED = 2
WRONG_PARAMETER = 3
ERROR_NO_GUI = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
-> Error
ELSE.
IF COUNT < 1.
-> Error
ENDIF.
ENDIF.U can use the method FILE_EXIST for the file
2007 Jul 03 2:41 PM
Aswlkm,
parameter p_filename like rlgrap-filename value 'c:\younus.txt'.
if p_filename is not initial.
call gui_download.
else.
Message e000 with 'the field p_filename can't be initial'.
endif.
the above if condition checks the field p_filename is initial or not,if initital means not given any path it will throw up an error message else will call the gui_upload.
K.Kiran.
2007 Jul 03 2:41 PM
Use this FM to split file name PC_SPLIT_COMPLETE_FILENAME into filename & extension then check the both as per your requirement.
Regards,
Amit
reward all helpful replies.
2007 Jul 03 2:42 PM
no need for validation , provide F4 help for that file
data: ifiletable type filetable.
data: xfiletable like line of ifiletable.
data: rc type i.
parameters: p_file1 type localfile default'C:test.txt'.
at selection-screen on value-request for p_file1.
call method cl_gui_frontend_services=>file_open_dialog
EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILENAME =
* FILE_FILTER =
INITIAL_DIRECTORY = 'C:'
* MULTISELECTION =
changing
file_table = ifiletable
rc = rc
* USER_ACTION =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
others = 4.
.
read table ifiletable into xfiletable index 1.
if sy-subrc = 0.
p_file1 = xfiletable-FILENAME.
endif.
2007 Jul 03 2:42 PM
HI u can use these function modules.
1) CV120_SPLIT_PATH
2) RZL_READ_DIR_LOCAL
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |