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

Input File Name

Former Member
0 Likes
2,312

Hi,

I would like to have input file name as ABC_date.csv  ....This name will be default and user just have to choose the path to store this file. I have created default file name as ABC_20130907.CSV but for this when I click on F4 then I have to first copy this name and have to put it as File Name in navigation window. Can it be possible that when we click on F4 button and this default file name would appear in that window ? ...Otherwise please suggest any possible way.

Thanks.

8 REPLIES 8
Read only

sivaganesh_krishnan
Contributor
0 Likes
1,292

Hi,

u can pass the defalult filename in the FM file_save_dialog

CALL METHOD cl_gui_frontend_services=>file_save_dialog  "File Save Dialog PopUp

          EXPORTING

            window_title      = 'title'    "WINDOW TITLE

            default_extension = ''

            default_file_name = 'filename'        " SET THE DEFAULT FILE NAME HERE

            initial_directory = '
C:\Users\Applexus\Desktop'           "DEFAULT LOCATION FOR POPUP

          CHANGING

            filename          = lv_filename

            path              = lv_drivepath

            fullpath          = lv_filepath

            user_action       = lv_result.

     .

Hope this Helps

Sivaganesh

Read only

gaurang_gujar
Contributor
0 Likes
1,292

Hi ,

There is one workaround I know in which in the AT_SELECTION SCREEN ON F4 routine You can replace the entire string after the Last "\" with your default file name

.

So irrespective what user selects it would be the default file that would be selected.

Regards,

Gaurang

Read only

0 Likes
1,292

Hi,

This can be done but it's not proper solution. Can we only select path through F4 ?....Actually it is not going ahead untill we give file name.

Thanks.

Read only

0 Likes
1,292

Hi ,

if you just want the  default name of file abc_date.csv  then you can use class suggested by shivaganesh or if you want the file to abc_date.csv  to be irrespective of the selected you can suggest the option suggested by me.

Request you to please explain us the requirement in detail

Regards and Thanks,

Gaurang

Read only

0 Likes
1,292

Hi,

I understood what you are suggesting. Can we select only path through F4 help??....So that user will select only path and i can be able to append file name ahead of that.

Thanks.

Read only

0 Likes
1,292

Hi,

I guess what you are saying is user should only be only able to select the path and by default

the user would be storing a default file name.

I am not aware of any such option will let you know once I come know about it.

But the workaround I suggested can be used as an alternative.

Regards,

Gaurang

Read only

Former Member
0 Likes
1,292

hi

  let the user first select the path or directory where he needs to place the file using F4 and then concatenate your filename  to the path selected by the user .

sample code is mentioned in the below link.

http://scn.sap.com/thread/841804

BR

Venkat

Read only

former_member530652
Participant
0 Likes
1,292

Use Following Code.

PARAMETERS: P_FILE TYPE LOCALFILE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

DATA: File_Path_Str TYPE STRING.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE

EXPORTING

WINDOW_TITLE = 'Your Folder'

CHANGING

SELECTED_FOLDER = File_Path_Str

EXCEPTIONS

CNTL_ERROR = 1.

CALL METHOD CL_GUI_CFW=>FLUSH

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2.

After this concatenate File_Path_Str to P_FILE. Also you can concatenate variables to the same as per your wish.

Regards,

Sandeep.