Application Development 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: 

How to validate a mentioned file path?

Former Member
0 Kudos

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

Former Member
0 Kudos

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 =

.

8 REPLIES 8

Former Member
0 Kudos

Hi,

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

Lokesh

Message was edited by: Lokesh Aggarwal

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

former_member188685
Active Contributor
0 Kudos

hi madhu,

you can use this method CL_GUI_FRONTEND_SERVICES=>FILE_EXIST

to check the file existance..

vijay

Former Member
0 Kudos

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 =

.

0 Kudos

Hi Vijay,

The FM CV120_DOC_FILE_EXISTENCE_CHECK works fine for local path.

Thanks,

Madhu