10-05-2009 12:39 PM
Hi,
Is it possible to select both file path and directory path from one parameter using F4?If yes how?
Thanks.
Edited by: Ginger on Oct 5, 2009 7:51 AM
10-05-2009 3:51 PM
Hi,
Try this way.
Thanks
Venkat.O
REPORT ztest_notepad.
DATA:g_server TYPE c.
PARAMETERS:p_server AS CHECKBOX USER-COMMAND uc1.
PARAMETERS:p_path TYPE dxfields-longpath.
PARAMETERS:p_file TYPE dxfields-longpath.
AT SELECTION-SCREEN OUTPUT.
CASE p_server.
WHEN 'X'.
CLEAR p_file.
g_server = 'A'.
p_path = '\usr\sap\tmp'.
WHEN space.
CLEAR p_file.
g_server = 'P'.
p_path = 'C:\'.
ENDCASE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = g_server
i_server = ' '
i_path = p_path
filemask = ' '
fileoperation = 'R'
IMPORTING
o_path = p_path.
p_file = p_path.
START-OF-SELECTION.
WRITE p_file.
10-05-2009 12:56 PM
And what exactly do you mean by "filepath" & "directory path"?
Are you talking about presentation server or application server paths ?
10-05-2009 12:59 PM
No...file can be anywhere....file path selection means will have file name(c:\abc.txt) and directory selection means only select 'C:\'
from which files can be selected.
Now I want to enable both the options in one parameter path.Is it possible?
10-05-2009 1:06 PM
>
> No...file can be anywhere....file path selection means will have file name(c:\abc.txt) and directory selection means only select 'C:\'
> from which files can be selected.
>
> Now I want to enable both the options in one parameter path.Is it possible?
AFAIK, it is not possible.
But you can try a workaround though 😛
Make two radio-buttons:
1. Select File (rb_file)
2. Select Directory (rb_dir)
Then based on the radio-button call the respective method
IF RB_FILE = 'X'.
Call Method CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
ELSEIF RB_DIR = 'X'.
Call Method CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
ENDIF.
BR,
Suhas
10-05-2009 1:53 PM
You can only achieve this through custom coding.
You can look at the function module F4_DXFILENAME_TOPRECURSION which displays a popup, where one can select application server or presentation server for file browse.
Using this as an example, you can build your own function module, where one can select file or directory.
Hope this will solve your problem
Regards,
S. Suresh Babu
10-05-2009 3:51 PM
Hi,
Try this way.
Thanks
Venkat.O
REPORT ztest_notepad.
DATA:g_server TYPE c.
PARAMETERS:p_server AS CHECKBOX USER-COMMAND uc1.
PARAMETERS:p_path TYPE dxfields-longpath.
PARAMETERS:p_file TYPE dxfields-longpath.
AT SELECTION-SCREEN OUTPUT.
CASE p_server.
WHEN 'X'.
CLEAR p_file.
g_server = 'A'.
p_path = '\usr\sap\tmp'.
WHEN space.
CLEAR p_file.
g_server = 'P'.
p_path = 'C:\'.
ENDCASE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = g_server
i_server = ' '
i_path = p_path
filemask = ' '
fileoperation = 'R'
IMPORTING
o_path = p_path.
p_file = p_path.
START-OF-SELECTION.
WRITE p_file.