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

validate files from application server

Former Member
0 Likes
663

Hi All,

how do i validate the path of a file which is in Presentation Server? please let me know the Function Modules/....

thnks,

Poonam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
628

Hi,

Please make use of this CLASS "CL_GUI_FRONTEND_SERVICES" there you can make use of

the methods

"FILE_EXIST" for checking the file existence

"DIRECTORY_EXIST" for checking the directory existence.

Hope this will help you.

Regards,

Smart Varghese

5 REPLIES 5
Read only

Former Member
0 Likes
629

Hi,

Please make use of this CLASS "CL_GUI_FRONTEND_SERVICES" there you can make use of

the methods

"FILE_EXIST" for checking the file existence

"DIRECTORY_EXIST" for checking the directory existence.

Hope this will help you.

Regards,

Smart Varghese

Read only

0 Likes
628

so we need to go for directory check first and then the file exitst right???

Read only

andrea_galluccio2
Contributor
0 Likes
628

Hi,

simply try an OPEN DATASET <fn> FOR INPUT IN TETX MODE (for the application) or call function GUI_UPLOAD (for the presentation) and check the sy-subrc .

If it's 4, there is an error in filename or path.

I know that is not the best way, but is the quick one (expecially for application server files).

Best Regards

Andrea

Read only

0 Likes
628

for application im doing the open data set only. but for presentation i dont think so GUI_UPLOAD is an good option.

Read only

Former Member
0 Likes
628

HI,

Use this method to check the existence of the file on the presentation server..

CL_GUI_FRONTEND_SERVICES->FILE_EXIST

CALL METHOD cl_gui_frontend_services=>file_exist
    EXPORTING
      file                 = l_file
    RECEIVING
      result               = l_result
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      wrong_parameter      = 3
      not_supported_by_gui = 4
      OTHERS               = 5.
  IF l_result NE on.
    CONCATENATE 'File not found:' l_program INTO msgtrc
                SEPARATED BY space.        
 ENDIF.