browse_files

in src/zgoog_conversation_agent/zgoog_i_conv_agent_imp.prog.abap [0:0]


  METHOD browse_files.

    DATA:
      lv_rc           TYPE i,
      lv_lines        TYPE string,
      lt_filetable    TYPE filetable,
      ls_file_table   TYPE gty_file_table,
      lv_window_title TYPE string.

    FIELD-SYMBOLS:
                   <ls_filetable>  TYPE file_table.

    CLEAR lt_filetable.
    lv_window_title = TEXT-004.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        window_title            = lv_window_title
        multiselection          = abap_true
      CHANGING
        file_table              = lt_filetable
        rc                      = lv_rc
      EXCEPTIONS
        file_open_dialog_failed = 1
        cntl_error              = 2
        error_no_gui            = 3
        not_supported_by_gui    = 4
        OTHERS                  = 5.
    IF sy-subrc <> 0.
*       Implement suitable error handling here
    ENDIF.

    LOOP AT lt_filetable ASSIGNING <ls_filetable>.
      ls_file_table-filename  = <ls_filetable>-filename.
      ls_file_table-mime_type = p_mime_file.

      APPEND ls_file_table TO gt_file_table.

    ENDLOOP.

    lv_lines = lines( gt_file_table ).
    IF lv_lines = 1.
      CONCATENATE lv_lines TEXT-002 INTO p_no_files
        SEPARATED BY space.
    ELSE.
      CONCATENATE lv_lines TEXT-003 INTO p_no_files
        SEPARATED BY space.

    ENDIF.