Menampilkan directory browse



bila suatu program digunakan untuk mengunduh suatu data pada program, biasanya user diberi kebebasan untuk meletakan file yang akan diunduh ke suatu directory folder. berikut ini adalah program yang bisa digunakan untuk mempermudah user menampilkan directory folder.

DATA: d_string TYPE string.

PARAMETERS:  p_file    TYPE rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  PERFORM f_get_directory.


*&---------------------------------------------------------------------*
*&      Form  f_get_directory
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM f_get_directory .

  CALL METHOD cl_gui_frontend_services=>directory_browse
    EXPORTING
      window_title    = 'Direcotry to Download File'
      initial_folder  = 'C:\'
    CHANGING
      selected_folder = d_string
    EXCEPTIONS
      cntl_error      = 1
      error_no_gui    = 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.

  IF d_string IS NOT INITIAL.
    p_file = d_string.
  ENDIF.

ENDFORM.                    " F_GET_DIRECTORY
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s