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: 

Opening a file fumction module ?

0 Kudos

HEllo,

I am doing coding for a ALV report here i got a requirement like when i click a button in application tool bar it has to open the browser.

For example we use function "F4_FILENAME" for opening the browser. where we can select the file, but here i want to open the file like after clicking the F4 help browser will open from there i should click on the file required by which it has to open the file?

Can anyone help me to achieve this.

Advance Thks

1 REPLY 1

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Use the "Execute" method of the frontend services class.

REPORT  zrich_0001.

DATA: v_rc TYPE i.
data: v_file type string.
DATA: lt_filetab TYPE filetable.
DATA: ls_filetab LIKE LINE OF lt_filetab.

PARAMETERS: p_file TYPE localfile.

AT SELECTION-SCREEN on VALUE-REQUEST FOR p_file.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    CHANGING
      file_table              = lt_filetab
      rc                      = v_rc
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      OTHERS                  = 5.
  READ TABLE lt_filetab INTO ls_filetab INDEX 1.
  IF sy-subrc = 0.
    v_file = ls_filetab-filename.

 CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
      document               = v_file.

  ENDIF.

Regards,

Rich Heilman