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: 

Check if a file exist

Former Member
0 Kudos

From abap i need to check if a file exist on the client pc.

Is this possible ?

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Sure, use CL_GUI_FRONTEND_SERVICES. There is a method called FILE_EXIST.

Regards,

Rich Heilman

0 Kudos

Here is a quick & dirty example program for ya.



report zrich_0004 .

data: file type string,
      result(1) type c.


start-of-selection.

  file = 'C:/abaps/test.txt'.

  call method cl_gui_frontend_services=>file_exist
    exporting
      file            = file
    receiving
      result          = result.


  if result = 'X'.
    write:/ 'file does exist'.
  else.
    write:/ 'file not found'.
  endif.

Regards,

Rich Heilman