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: 

F4_FILENAME - For selecting a local file from a Selection-Screen

Former Member
0 Kudos

This code in ERP will allow me to drill down to my local drive to select a file:

However, anybody know a similar Function Module in BW to do this?

F4_Filename does not exist, at least in our BW environment.

Thank-You.

PARAMETER: p_locat LIKE rlgrap-filename

DEFAULT '/interfaces_r3/inbound/archive/RGIS/RGISTOSAP.TXT.20061008'.

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

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_locat.

PERFORM get_file USING p_locat.

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

form get_file using p_locat.

DATA: v_file LIKE ibipparms-path.

MOVE: p_locat TO v_file.

DATA: v_repid LIKE syst-repid,

v_dynnr LIKE syst-dynnr.

v_repid = syst-repid.

v_dynnr = syst-dynnr.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = v_repid

dynpro_number = v_dynnr

  • field_name = field

IMPORTING

file_name = v_file.

MOVE: v_file TO p_locat.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Hopefully, the class is in BW.



report zrich_0001.

data: ifiletable type filetable.
data: xfiletable like line of ifiletable.
data: rc type i.

parameters: p_file1 type localfile default'C:test.txt'.

at selection-screen on value-request for p_file1.

call method cl_gui_frontend_services=>file_open_dialog
   EXPORTING
*    WINDOW_TITLE            =
*    DEFAULT_EXTENSION       =
*    DEFAULT_FILENAME        =
*    FILE_FILTER             =
     INITIAL_DIRECTORY       = 'C:'
*    MULTISELECTION          =
  changing
    file_table              = ifiletable
    rc                      = rc
*    USER_ACTION             =
  EXCEPTIONS
    FILE_OPEN_DIALOG_FAILED = 1
    CNTL_ERROR              = 2
    ERROR_NO_GUI            = 3
    others                  = 4.
        .
 read table ifiletable into xfiletable index 1.
 if sy-subrc = 0.
  p_file1 = xfiletable-FILENAME.
 endif.

Regards,

Rich Heilman

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Hopefully, the class is in BW.



report zrich_0001.

data: ifiletable type filetable.
data: xfiletable like line of ifiletable.
data: rc type i.

parameters: p_file1 type localfile default'C:test.txt'.

at selection-screen on value-request for p_file1.

call method cl_gui_frontend_services=>file_open_dialog
   EXPORTING
*    WINDOW_TITLE            =
*    DEFAULT_EXTENSION       =
*    DEFAULT_FILENAME        =
*    FILE_FILTER             =
     INITIAL_DIRECTORY       = 'C:'
*    MULTISELECTION          =
  changing
    file_table              = ifiletable
    rc                      = rc
*    USER_ACTION             =
  EXCEPTIONS
    FILE_OPEN_DIALOG_FAILED = 1
    CNTL_ERROR              = 2
    ERROR_NO_GUI            = 3
    others                  = 4.
        .
 read table ifiletable into xfiletable index 1.
 if sy-subrc = 0.
  p_file1 = xfiletable-FILENAME.
 endif.

Regards,

Rich Heilman

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try FM KD_GET_FILENAME_ON_F4.

Regards,

Ferry Lianto