2005 Sep 12 3:21 PM
hey guys,
I want to check my file path validation and display error in same screen itself.
I used my GUI_UPLOAD method in START OF SELECTION. to read the file.
If error it displays error in some other plain screen.
I know AT selection screen will allow me to display in same screen.
But is the way of using GUI_UPLOAD method in AT selection screen is advisable?
or else please give me alternate way.
ambichan
Did the answers help you? Can you please close the post if resolved?
Thanks,
Srinivas
2005 Sep 12 3:28 PM
Hi Ambhi,
If you want to validate for existance of file
use
DATA : l_f_exist(1).
CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
EXPORTING
fname = p_inp
IMPORTING
exist = l_f_exist
EXCEPTIONS
fileinfo_error = 1
OTHERS = 2.
IN AT SELECTION SCREEN.
<i>I assume you are not validating data in the file at selection screen.</i>
Rgds,
Mano Sri
Message was edited by: Mano Sri
2005 Sep 12 3:35 PM
hai mano,
thanks for your reply.
Does P_inp parameter allows only file name or
FILE PATH.
could you pls confirm.
ambichan
2005 Sep 12 3:37 PM
up to 128 char i guess , so you can try with file path
Rgds,
M
2005 Sep 12 3:37 PM
Hi
You can use in AT Selection screen
data result.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
EXPORTING
FILE = 'C:\test.txt'
RECEIVING
RESULT =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
the return parameter will be "X" if file exists else it will be blank.
Cheers
2005 Sep 12 3:39 PM
Hi Ambi,
You can do the GUI_UPLOAD in the AT SELECTION-SCREEN event, provided you do that only when the user presses the 'Execute' or 'F8' button. That way you will avoid doing it all the time. AT SELECTION-SCREEN will be executed before the START-OF-SELECTION and any error you give there, the processing stops there and you remain in the selection screen.
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'ONLI'.
CALL FUNCTION 'GUI_UPLOAD'
........
.....
WHEN OTHERS.
ENDCASE.
2005 Sep 13 1:56 AM
To valid the existance of file in presentation or application server u can use SXDA_FILE_EXISTENCE_CHECK
CALL FUNCTION 'SXDA_FILE_EXISTENCE_CHECK'
EXPORTING
DS_NAME = P_FPATH "file path
DATA_APP = 'X'
DATA_REM = SPACE
SERVER = SPACE
DATA_FRN = SPACE
PC_FILE = SPACE
IMPORTING
FILE_EXISTS = W_XFLAG
EXCEPTIONS
RFC_FAILURE = 1
FRONTEND_ERROR = 2
DB_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
STOP.
ENDIF.
IF W_XFLAG EQ 'X'.
WRITE:/001 'File exists'.
ELSE.
WRITE:/001 'File does not exists'.
ENDIF.
regards
venkat
2005 Sep 13 6:51 AM
Give an Information message and do a leave to transaction <same program>
Rajiv
2005 Sep 13 4:01 PM
Hello Mr. Chan,
I guess you forgot to close the thread , hope problem is not persisting.
-M
2005 Sep 16 4:08 AM
Did the answers help you? Can you please close the post if resolved?
Thanks,
Srinivas
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |