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

Function to get user defined folder path to save file on local PC

Former Member
0 Likes
3,539

Hi Experts,

I need an F/M which can be used to get the specified folder selected by end user in browsing window in a target path ( as Parameter type).

Thanks in advance.

6 REPLIES 6
Read only

Former Member
0 Likes
1,401

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = ' '

IMPORTING

file_name = p_file1.

Read only

Former Member
0 Likes
1,401

KD_GET_FILENAME_ON_F4

Read only

former_member156446
Active Contributor
0 Likes
1,401

Hi there you can use

CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
CALL METHOD cl_gui_frontend_services=>file_open_dialog
  EXPORTING
    window_title      = 'Select File'
    default_filename  = ',*.*  ,*.*.'
    initial_directory = 'C:\'
    multiselection    = ' '  "No multiple selection
  CHANGING
    file_table        = it_tabemp
    rc                = gd_subrcemp.

Read only

0 Likes
1,401

Hi Jay,

Actually I don't need to give the filename in open folder dialog box. I only want the end user to select own directory path where he/she wants to save the file. I need to download the 'PDF' documents attached to a Specification in SAP EHS. I ll get the document downloaded from BAPI 'BAPI_DOCUMENT_CHECKOUTVIEW2' in system defined path, i.e. in SAP Work-directory. Now, File name is generated dynamically and attached with the 'User Specified Folder Path' internally in report.

Please suggest more.

Thanks for ur reply.

Read only

0 Likes
1,401

Hi

U can try to use the method DIRECTORY_BROWSE of class CL_GUI_FRONTEND_SERVICES

Max

Read only

0 Likes
1,401

Ohh ok..

We have this option of using FM :

SO_SPLIT_FILE_AND_PATH

Splits the filename and its path i.e. c:\temp\hello.txt would return 'hello.txt' & 'c:\temp\'