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

file checking

Former Member
0 Likes
500

Hi,

is there any way to check the existence of the file at the specified location.

Thanks,

Sreeram.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
468

Hi Sreeram,

Check with TMP_GUI_GET_FILE_EXIST.

Hope this solves your problem.

Regards,

SB.

3 REPLIES 3
Read only

Former Member
0 Likes
469

Hi Sreeram,

Check with TMP_GUI_GET_FILE_EXIST.

Hope this solves your problem.

Regards,

SB.

Read only

former_member156446
Active Contributor
0 Likes
468
CL_GUI_FRONTEND_SERVICES=>FILE_EXIST

Example:


data:RCbool type ABAP_BOOL.
  WRITE: / 'TEST METHOD FILE_EXIST'.
  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
    EXPORTING
      FILE                 = 'c:\temp\test_frontend_services.txt'
    RECEIVING
      RESULT               = rcbool
*  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.

  WRITE: / RCbool.

Read only

Former Member
0 Likes
468

Hi,

You can check existence of a file in one of the 2 ways mentioned below:

1. Using function module 'DX_FILE_EXISTENCE_CHECK'.

2. Using Class Static Method 'CL_GUI_FRONTEND_SERVICES=>FILE_EXIST'

Do search on them and you will get all the details necessary.

Regards.