Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to validate a mentioned file path?

Former Member
0 Likes
1,364

Hi,

I have joined the forum recently.

How to check if a local path in sel.screen is valid?.

I have already checked the FMs PC_CHECK*. These FMs do not actually access the PC and check for existence of mentioned path.

Thanks,

Madhu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,313

Hi madhu

Check these FM's

CONV_UTIL_CHECK_FILE_EXISTENCE

CV120_DOC_FILE_EXISTENCE_CHECK

CV122_DOC_FILE_EXISTENCE_CHECK

DX_FILE_EXISTENCE_CHECK

PFL_CHECK_OS_FILE_EXISTENCE

i have u another idea!

try this following code

selection-screen begin of block b1 with frame .

PARAMETER : FILE(100) lower case.

selection-screen end of block b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

  • DEF_FILENAME = ' '

DEF_PATH = '.'

  • MASK = ' '

  • MODE = ' '

  • TITLE = ' '

IMPORTING

FILENAME = FILE

  • RC =

.

Hi Vijay,

The FM CV120_DOC_FILE_EXISTENCE_CHECK works fine for local path.

Thanks,

Madhu

8 REPLIES 8
Read only

Former Member
0 Likes
1,313

Hi,

Could you tell me what you want to do with the file you want to read.

Lokesh

Message was edited by: Lokesh Aggarwal

Read only

0 Likes
1,313

Hi,

I want to create a file, say log.txt in the mentioned path. I would do this using WS-DOWNLOAD. But first I want to ascertain that the mentioned path exists in the PC.

Thanks,

Madhu

Read only

0 Likes
1,313

Hi,

You can use the same file path in WS_download and do this in at selection-screen event.

You will get an FILE_OPEN_ERROR exception if the path is not correct. (SY-SUBRC = 1)

Hope it helps...

Lokesh

Pls. reward appropriate points

Message was edited by: Lokesh Aggarwal

Read only

Former Member
0 Likes
1,313

hi, function like WS_QUERY or method CL_GUI_FRONTEND_SERVICES=>FILE_EXIST will helpful to you.

If you want to do a validation on the local path.

thanks

Read only

Former Member
0 Likes
1,313

Try FM DX_FILE_EXISTENCE_CHECK.

If you enter the path including file name in import parameter 'FILENAME'and enter value X gainst import parameter PC, you will get value for export parameter FILE_EXISTS as X if the file is present.

Read only

Former Member
0 Likes
1,313

hi madhu,

you can use this method CL_GUI_FRONTEND_SERVICES=>FILE_EXIST

to check the file existance..

vijay

Read only

Former Member
0 Likes
1,314

Hi madhu

Check these FM's

CONV_UTIL_CHECK_FILE_EXISTENCE

CV120_DOC_FILE_EXISTENCE_CHECK

CV122_DOC_FILE_EXISTENCE_CHECK

DX_FILE_EXISTENCE_CHECK

PFL_CHECK_OS_FILE_EXISTENCE

i have u another idea!

try this following code

selection-screen begin of block b1 with frame .

PARAMETER : FILE(100) lower case.

selection-screen end of block b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

  • DEF_FILENAME = ' '

DEF_PATH = '.'

  • MASK = ' '

  • MODE = ' '

  • TITLE = ' '

IMPORTING

FILENAME = FILE

  • RC =

.

Read only

0 Likes
1,313

Hi Vijay,

The FM CV120_DOC_FILE_EXISTENCE_CHECK works fine for local path.

Thanks,

Madhu