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: 

Search help for files

former_member622551
Participant
0 Kudos

Hello, is there any search help for searching files in local pc?

I need it for a dynpro.

Any help?

Thanks!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I didnt find any,

I think you can create one for your need from SE11

Regards,

Sid

8 REPLIES 8

Former Member
0 Kudos

Hi,

I didnt find any,

I think you can create one for your need from SE11

Regards,

Sid

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

You have to code for this in the PROCESS ON VALUE-REQUEST block.

Inside this block you have to call the static method: CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG.

Hope i am clear.

BR,

Suhas

Former Member
0 Kudos

Though in the Code a dialog will open to select for directory , you need to define your logic or user can input the directory .


REPORT abc.

PARAMETERS  check AS CHECKBOX .
types :
begin of ty_text,

text(100) type c,
  end of ty_text.
  
  data : l_folder type string,
         l_count type i,
         l_file_table type standard table of ty_text.



CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE

  CHANGING
    SELECTED_FOLDER      = l_folder.



CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
  EXPORTING
    DIRECTORY                   = l_folder
  CHANGING
    FILE_TABLE                  = l_file_table
    COUNT                       = l_count.

I assumed you are aware of CL_GUI_FRONTEND_SERVICES=>file_open_dialog. I thought you want a list of all files and not usual file open dialog, and want to display that list like any other F4. )

Edited by: rajesh khatwa on Nov 30, 2009 5:17 PM

Former Member
0 Kudos

You shoul use:

cl_gui_frontend_services=>file_open_dialog

Rob

Former Member
0 Kudos

Hi,

I doubt for webdynpro you could be able to use gui frontend services....

Anyways you can give it a try....

otherwise there are some other classes for the same explicitly for webdynpro's

Regards,

Sid

Former Member
0 Kudos

Hi ,

Try this way...



PROCESS ON VALUE-REQUEST.
FIELD <DYNPRO-FIELDNAME>  MODULE F4_filename.

MODULE F4_filename INPUT.

* Drop down to retrieve File Path
  DATA: w_lcnt      TYPE i,
        t_lfilename TYPE filetable,
        w_lfilename LIKE LINE OF t_lfilename.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = 'Find File Path'
    CHANGING
      file_table              = t_lfilename
      rc                      = w_lcnt
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      OTHERS                  = 5.
  IF sy-subrc <> 0.
  ENDIF.

  READ TABLE t_lfilename INTO w_lfilename INDEX 1.
  IF sy-subrc NE 0.
    CLEAR w_lfilename.
  ENDIF.
  <DYNPRO-FIELDNAME> = w_lfilename-filename.


ENDMODULE.

regards,

Prabhudas

venkat_o
Active Contributor
0 Kudos

Hi Javier, <li>Try this way.


  REPORT ztest_program.
  DATA: wa_pfile TYPE file_table.
  DATA: it_pfiles TYPE STANDARD TABLE OF file_table,
       count   TYPE i,
       dir     TYPE string VALUE 'C:\temp\'.
  CALL METHOD cl_gui_frontend_services=>directory_list_files
    EXPORTING
      directory                   = dir
      files_only                  = 'X'
    CHANGING
      file_table                  = it_pfiles
      count                       = count
    EXCEPTIONS
      cntl_error                  = 1
      directory_list_files_failed = 2
      wrong_parameter             = 3
      error_no_gui                = 4
      not_supported_by_gui        = 5
      OTHERS                      = 6.
  LOOP AT it_pfiles INTO wa_pfile.
    WRITE wa_pfile.
  ENDLOOP.
Thanks Venkat.O

former_member622551
Participant
0 Kudos

All this solutions are right for reports, but i need the code for a dynpro. I suppose that must be inserted in the PBO or PAI sections.

Thanks.