Application Development 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: 

Both file and directory path selection

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

venkat_o
Active Contributor
0 Kudos

Hi, Try this way.


  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.
Thanks Venkat.O

5 REPLIES 5

SuhaSaha
Advisor
Advisor
0 Kudos

And what exactly do you mean by "filepath" & "directory path"?

Are you talking about presentation server or application server paths ?

Former Member
0 Kudos

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?

0 Kudos

>

> 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

anusurbab
Explorer
0 Kudos

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

venkat_o
Active Contributor
0 Kudos

Hi, Try this way.


  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.
Thanks Venkat.O