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

Function module to check if a given file/folder path is valid or not?

Former Member
0 Likes
2,091

Hi,

I am using function modules GUI_DOWNLOAD and GUI_UPLOAD.

Is there any function module to check if a given file/folder path is valid or not?

Thanks.

4 REPLIES 4
Read only

valter_oliveira
Active Contributor
0 Likes
1,199

Hello.

Yes, you can use class cl_gui_frontend_services, method DIRECTORY_EXIST.

Regards,

Valter Oliveira.

Read only

sachin_mathapati
Contributor
0 Likes
1,199

Hi Kumar ,

REPORT zdir_test.

TYPE-POOLS: abap.

DATA: v_dir TYPE string.

DATA: v_bol TYPE abap_bool.

v_dir = 'c:\sap\'.

CALL METHOD cl_gui_frontend_services=>directory_exist

EXPORTING

directory = v_dir

RECEIVING

result = v_bol

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

wrong_parameter = 3

not_supported_by_gui = 4

OTHERS = 5.IF NOT v_bol IS INITIAL.

WRITE:/ 'Directory exists.'.

ELSE.

WRITE:/ 'Directory does not exist.'.

ENDIF.

Regards,

Sachin M M

Read only

GauthamV
Active Contributor
0 Likes
1,199

hi,

if u r hardcoding the path directly ,then there is no issue becse u dont get any error.

if u r using f4_filename function module to get file then u can check in the bottom.

if sy-subrc NE 0.

message 'file not found' type 'E'.

endif.

Read only

Former Member
0 Likes
1,199

Hi,

You can use the DIRECTORY_EXIST method.

cl_gui_frontend_services=>directory_exist

for more details check this link:

Regards

Adil