Skip to Content
author's profile photo Former Member
Former Member

Check directory_exist

Hi experts,

I'm doing directory path validation using below code.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST

EXPORTING

DIRECTORY = L_DIRECTORY

RECEIVING

RESULT = L_STRING

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

WRONG_PARAMETER = 3

NOT_SUPPORTED_BY_GUI = 4

OTHERS = 5.

IF L_STRING = SPACE.

MESSAGE 'invalid directory' type 'E'.

ENDIF.

In above i'm getting L_STRING value SPACE instead of 'X' and sy-subrc = 1. But i'm giving valid directory.

when i debugging i'm getting error in the below code.

CALL METHOD CL_GUI_CFW=>FLUSH

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2

others = 3 .

IF SY-SUBRC <> 0. " here i'm getting sy-subrc =2.

RAISE CNTL_ERROR.

ENDIF.

It's working in othere systems except mine. can't able to get the issue. Help me....!

<<offer for points removed>>

Regards,

BALAJI.

Message was edited by: Kesavadas Thekkillath

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2012 at 09:15 AM

    Hi All,

    Problem with SAP GUI with windows connectivity.

    Today when i double click on SAP GUI button it's ask for update and i updated the same through company network. Now everything is working fine.

    Thanks for all.

    Regards,

    BALAJI.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 20, 2012 at 07:01 AM

    Hi

    Directories are case Sensitives.. So make sure you enter correct directory name..

    or select the directory from this FM.. then we see the result, if it works without dump then Directory name issue.. If no Check the other results below.

    *LOCAL DATA DECLARATIONS.
    DATA : lv_temppath TYPE rlgrap-filename,
    lv_filepath TYPE rlgrap-filename.

    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
    directory = lv_temppath
    IMPORTING
    serverfile = lv_filepath
    EXCEPTIONS
    canceled_by_user = 1
    OTHERS = 2.

    IF sy-subrc = 0.
    "VALIDATING DATA FOR CORRECT SELECTION OF FILE IN THE SELECTION SCREEN
    IF 'REPAIR' CO lv_filepath.
    p_pfile = lv_filepath.
    ELSE.
    MESSAGE i009(zz) WITH 'Selected file is incorrect'(003).
    ENDIF.
    ENDIF.

    Pathname and Result are typed Correctly.. L_DIRECTORY should be of Type STRING or logicalpath

    Hope this helps...

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Balaji,

      Please check if the variable H_CONTROL is initial or not in Method CALL_METHOD inside the original method. In order to get there, please active the system debugging.

      Also, in debugging the CALL METHOD CL_GUI_CFW=>FLUSH check the FM OLE_FLUSH_CALL ; It seems the exception is getting raised from this FM.

      I can not replicate the exact scenario so its difficult for me to tell you the exact reason but in debugging you will find it on your won.

      Hope this will help you in getting closed to the solution.

      Thanks,

      Rahul

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.