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

Request for a function for path of directory ??

Former Member
0 Likes
1,584

hi,

i need a function module to get me the physical path of the directory on F4

for eg.

function module 'KD_GET_FILENAME_ON_F4'

allows us to select the file (on pressing F4) and gives the physical path of the selected file.

Similarly i want the function which selects the DIRECTORY and gives the physical path of the DIRECTORY..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,468

Take a look at the CL_GUI_FRONTEND_SERVICES, and you will find all kinds of the methods, which will solve your requirement.

Regards,

Ravi

Note - Please mark all the helpful answers

hi,

i need a function module to get me the physical path of the directory on F4

for eg.

function module 'KD_GET_FILENAME_ON_F4'

allows us to select the file (on pressing F4) and gives the physical path of the selected file.

Similarly i want the function which selects the DIRECTORY and gives the physical path of the DIRECTORY..

11 REPLIES 11
Read only

Former Member
0 Likes
1,468

hi,

try FM F4_FILENAME.

use it in at selection-screen on value-request for ...

event.

santhosh

Message was edited by:

Kaluvala Santhosh

Read only

Former Member
0 Likes
1,468

Hi,

Check this thread.

Cheers

VJ

Read only

Former Member
0 Likes
1,469

Take a look at the CL_GUI_FRONTEND_SERVICES, and you will find all kinds of the methods, which will solve your requirement.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

Former Member
0 Likes
1,468

HI,

FM F4_dxfilename_toprecursion

Check out this thread..

Check FM RZL_READ_DIR_LOCAL for directory path..

Check this out

Regards,

Laxmi.

Read only

0 Likes
1,468

hi,

all the above are used for getting the path for FILENAME..

but none of them is used for getting just the DIRECTORY..

Please Reply.

Thanks

Read only

0 Likes
1,468

Anuj

The follwing are the methods of CL_GUI_FRONTEND_SERVICES that deal with directories

DIRECTORY_BROWSE

DIRECTORY_CREATE

DIRECTORY_DELETE

DIRECTORY_EXIST

DIRECTORY_GET_CURRENT

DIRECTORY_LIST_FILES

DIRECTORY_SET_CURRENT

GET_WINDOWS_DIRECTORY

GET_TEMP_DIRECTORY

If you want to get the directory, DIRECTORY_GET_CURRENT and GET_WINDOWS_DIRECTORY should help you.

Regards,

Ravi

Note - Please mark the helpful answers

Read only

0 Likes
1,468

hi ,

you have mentioned

**************************************************8

The follwing are the methods of CL_GUI_FRONTEND_SERVICES that deal with directories

DIRECTORY_BROWSE

DIRECTORY_CREATE

DIRECTORY_DELETE

DIRECTORY_EXIST

DIRECTORY_GET_CURRENT

DIRECTORY_LIST_FILES

DIRECTORY_SET_CURRENT

GET_WINDOWS_DIRECTORY

GET_TEMP_DIRECTORY

If you want to get the directory, DIRECTORY_GET_CURRENT and GET_WINDOWS_DIRECTORY should help you.

***********************************************************************************

But none of the functions are existing in SAP ??

Please reply.

Thanks

Anuj

Read only

0 Likes
1,468

Anuj,

These are not functions, these are methods of the class CL_GUI_FRONTEND_SERVICES.

Go to SE24, put in CL_GUI_FRONTEND_SERVICES and you can see all the methods that I have mentioned here.

Here is a sample call


  CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_WINDOWS_DIRECTORY
    CHANGING
      WINDOWS_DIRECTORY    =
*    EXCEPTIONS
*      CNTL_ERROR           = 1
*      ERROR_NO_GUI         = 2
*      NOT_SUPPORTED_BY_GUI = 3
*      others               = 4
          .
  IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

0 Likes
1,468

Ravi,

My sample code is..

*******************************************************************************************

REPORT ZEST_DOWNLOAD.

PARAMETERS: p_fname type STRING.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_WINDOWS_DIRECTORY

CHANGING

WINDOWS_DIRECTORY = p_fname

  • EXCEPTIONS

  • CNTL_ERROR = 1

  • ERROR_NO_GUI = 2

  • NOT_SUPPORTED_BY_GUI = 3

  • others = 4

.

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

***************************************************************************************************

When i am executing this method 'GET_WINDOWS_DIRECTORY' function is getting called but there is no pop up for directory selection and neither it is raising any exceptions.. what should i do now ??

Read only

0 Likes
1,468

> When i am executing this method

> 'GET_WINDOWS_DIRECTORY' function is getting called

> but there is no pop up for directory selection and

> neither it is raising any exceptions.. what should i

> do now ??

Hi Anuj Pachauri,

I had the same problem. Just add

CALL METHOD CL_GUI_CFW=>FLUSH.

or the FM CONTROL_FLUSH

CALL FUNCTION 'CONTROL_FLUSH'.

after the first method is called.

It transfers the buffered automation-queue to the frond-end.

In your case:

*******************************************************************************************

REPORT ZEST_DOWNLOAD.

PARAMETERS: p_fname type STRING.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_WINDOWS_DIRECTORY

CHANGING

WINDOWS_DIRECTORY = p_fname

  • EXCEPTIONS

  • CNTL_ERROR = 1

  • ERROR_NO_GUI = 2

  • NOT_SUPPORTED_BY_GUI = 3

  • others = 4

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

<b>

CALL METHOD CL_GUI_CFW=>FLUSH.</b>

write: p_fname.

***************************************************************************************************

This should solve the problem.

Reward with points if helped, please.

Message was edited by:

Erik Nagler

Read only

Former Member
0 Likes
1,468

Hi ,

Check these from CL_GUI_FRONTEND_SERVICES


->DIRECTORY_BROWSE
->DIRECTORY_GET_CURRENT
->DIRECTORY_LIST_FILES
->DIRECTORY_SET_CURRENT

Regards,

Raghav