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

Check directory_exist

former_member392866
Active Participant
0 Likes
2,595

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

1 ACCEPTED SOLUTION
Read only

former_member392866
Active Participant
0 Likes
2,213

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.

8 REPLIES 8
Read only

Venkat_Sesha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,213

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...

Read only

0 Likes
2,213

Hi Venkat,

Thank for quick responce..

It's working in other systems except mine.

I think problem with system settings only.. What you say?

Regards,

BALAJI.

Read only

Venkat_Sesha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,213

To check whether you have any GUI Problems..

From SAP Screen Menu Path..

Customize Local Layout (Alt + F2)

Goto System Information.

Click on the Check GUI Button.. It will analyse and give a report of error if you have any..

Hope this helps...

Read only

0 Likes
2,213

Hi Balaji,

Please try debugging the method DIRECTORY_EXIST directly using the simplest directory as "C:\Program Files".

In my case, it is returning the result as 'X' for valid directory and space in case of blank or invalid directory.

Detailed debugging of method may gives you some clue.

Thanks

Rahul

Read only

0 Likes
2,213

Hi Rahul,

I'm giving valid directory only but not getting 'X' (i'm getting space only).

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.

do u know the reason for that.

Regards,

BALAJI.

Read only

0 Likes
2,213

Hi Rahul,

I'm giving valid directory only but not getting 'X' (i'm getting space only).

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.

do u know the reason for that.

Regards,

BALAJI.

Read only

0 Likes
2,213

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

Read only

former_member392866
Active Participant
0 Likes
2,214

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.