2008 Jan 16 7:01 AM
I am creating session process for BDC
For that i am taking the flat file at runtime.i want check whether the entered file is valid or not..that means it exists are not?
how to do that..
2008 Jan 16 7:06 AM
Hi,
If you are uploading file from Presentation server, you will be using GUI_UPLOAD function module. If file does not exist it will return error. (sy-subrc <> 0).
If you are fetching from Application server ,
OPEN DATASET ...
will return sy-subrc as 4.
2008 Jan 16 7:04 AM
Hi Ravee
If you are reading the file from the presentation server then use this class method, CL_GUI_FRONTEND_SERVICES->FILE_EXIST to check if the file exists.
If you are reading the file from the application server then use the FM SUBST_GET_FILE_LIST, by passing the file name and path. If it returns an entry then that file is valid.
Cheers
~ Ranganath
2008 Jan 16 7:06 AM
Hi,
If you are uploading file from Presentation server, you will be using GUI_UPLOAD function module. If file does not exist it will return error. (sy-subrc <> 0).
If you are fetching from Application server ,
OPEN DATASET ...
will return sy-subrc as 4.
2008 Jan 16 7:07 AM
Hi,
DATA: W_FILENAME TYPE STRING,
W_RESULT TYPE C.
W_FILENAME = WK_DIRECTRY.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
EXPORTING
FILE = W_FILENAME
RECEIVING
RESULT = W_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.
IF W_RESULT IS INITIAL.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
EXPORTING
DIRECTORY = W_FILENAME
RECEIVING
RESULT = W_RESULT
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
IF SY-SUBRC 0.
ENDIF.
ENDIF.
IF W_RESULT = 'X'.
RC = '1'.
ELSE.
RC = '0'.
ENDIF.
Regards,
nagaraj
2008 Jan 16 7:09 AM
Hi Ravindra,
After uploading the data using GUI_UPLOAD check the sy-subrc value .
If it is ZERO : successful (FILE IS UPLOADED)
If it is NON-ZER0 : unsuccessful
Reward points if helpful.
Kiran Kumar.G.A
Have a Nice Day..
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |