cancel
Showing results for 
Search instead for 
Did you mean: 

file open dialog

Former Member
0 Kudos

Hi all,

I m using cl_gui_frontend_services->FILE_OPEN_DIALOG to display a PDF file which is prsent in the presentation server ..but what value should i pass to FILE_TABLE and RC...

fragment of code::

.........................CONVERT TO OTF TO PDF.......................

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = v_bin_filesize

TABLES

otf = st_job_output_info-otfdata

doctab_archive = it_docs

lines = it_lines

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT V_GUIOBJ.

CALL METHOD V_GUIOBJ->FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = V_WINDOW_TITLE

DEFAULT_EXTENSION = 'pdf'

DEFAULT_FILENAME = V_DEFAULT_FILENAME

CHANGING

FILE_TABLE = it_lines

  • RC = 1

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4.

IF SY-SUBRC <> 0.

ENDIF.

pls help..

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

<b><u>See this sample code.</u></b>

<u>For File_open_dialog</u>

form get_filename  using value(p_flag) type rprxxxxx-kr_feld4
                   changing p_filename type rlgrap-filename.


  class cl_gui_frontend_services definition load.

  data: l_filefilter   type string,
        l_filename     type string,
        l_filetable    type filetable,
        l_rc           type i,
        l_user_action  type i,
        l_window_title type string.

* only when local
  check p_flag is initial.

* Set data type drop-down and popup title
  concatenate cl_gui_frontend_services=>filetype_text
              cl_gui_frontend_services=>filetype_all
          into l_filefilter.
  l_window_title = text-f02.

* Dialogue
  call method cl_gui_frontend_services=>file_open_dialog
    exporting
      window_title            = l_window_title
      default_extension       = con_ext
*     DEFAULT_FILENAME        =
      file_filter             = l_filefilter
      initial_directory       = con_init_dir
*     MULTISELECTION          =
    changing
      file_table              = l_filetable
      rc                      = l_rc
      user_action             = l_user_action
    exceptions
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      others                  = 5
          .
  if sy-subrc <> 0.
    message e899(5a) with 'Error'.
  endif.

* dialogue not canceled
  check l_user_action <> cl_gui_frontend_services=>action_cancel.

  read table l_filetable into l_filename index 1.
  check sy-subrc = 0.
  p_filename = l_filename.

endform.                    " get_filename

----


<u>For executing a File on your PC</u>

<b>Here you need to call your .pdf file on your PC</b>

Report  ztest_file_execute             .

call function 'WS_EXECUTE'
     exporting
*         DOCUMENT           = ' '
*         CD                 = ' '
*         COMMANDLINE        = ' '
*         INFORM             = ' '
          program            = 'C:winntexplorer.exe'
*         STAT               = ' '
*         WINID              = ' '
*         OSMAC_SCRIPT       = ' '
*         OSMAC_CREATOR      = ' '
*         WIN16_EXT          = ' '
*         EXEC_RC            = ' '
*    IMPORTING
*         RBUFF              =
     exceptions
          frontend_error     = 1
          no_batch           = 2
          prog_not_found     = 3
          illegal_option     = 4
          gui_refuse_execute = 5
          others             = 6.

if sy-subrc ne 0.
  message i010(bctrain).
endif.

Regards

- Atul

Former Member
0 Kudos

Sorry for the delay...

When we are using cl_gui_frontend_services=>file_open_dialog it is asking for the file which needs to be opened…

But cl_gui_frontend_services ->EXECUTE will actually opens the file which is saved in the PC..

But can we have a functionality that the file needs to be opened just like preview and can save it by see the file..

Thanks

Former Member
0 Kudos

Hi

Yes... it's quite possible.

Just to confirm, Please detail your requirement so that i can code it accordingly.

Regards

- Atul

Former Member
0 Kudos

Code sent to ur mail ID

Thank U

Former Member
0 Kudos

Thanks..

still investigating.. wl sson get back with details on your email id.

Regards

- Atul

Former Member
0 Kudos

Thanks!

Waiting for u reply...