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 filename+path

Former Member
0 Kudos

Hello,

When i need to get a file name and its path , i use the f.m. "WS_FILENAME_GET" that popup an explorer window.

I'm looking for a search help that do the same, so i can link it to a data element .

Thank you,

koby

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

there is no such search help. You need to do it like this:

PARAMETERS: p_file TYPE rlgrap-filename.
DATA: gt_filetab TYPE filetable,
      gs_file TYPE file_tab,
      gv_rc TYPE i.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CLEAR gt_filetab.
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      multiselection    = space
    CHANGING
      file_table        = gt_filetab
      rc                = gv_rc.

  LOOP AT gt_filetab INTO gs_file.
    p_file = gs_file-filename.
  ENDLOOP.

Regards,

Adrian

14 REPLIES 14

Former Member
0 Kudos

Hi Kobby,

Use rlgrap-filename.

Former Member
0 Kudos

Hi,

there is no such search help. You need to do it like this:

PARAMETERS: p_file TYPE rlgrap-filename.
DATA: gt_filetab TYPE filetable,
      gs_file TYPE file_tab,
      gv_rc TYPE i.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CLEAR gt_filetab.
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      multiselection    = space
    CHANGING
      file_table        = gt_filetab
      rc                = gv_rc.

  LOOP AT gt_filetab INTO gs_file.
    p_file = gs_file-filename.
  ENDLOOP.

Regards,

Adrian

kesavadas_thekkillath
Active Contributor
0 Kudos

Check link:[http://sapprograms.blogspot.com/2008/11/f4-for-files-on-presentation-or.html]

0 Kudos

Mr. Keshav,

What i'm looking for is a search-help so i can connect it to a data element. It will be used,for instent, when i build

a maintenence dialog thru trans SE54. Te file search will be "build in" when i will use my data element.

Thank you for your answer,anyway.

Best regard,

koby

0 Kudos

I think you cannot bring this functionality with a data element.

You can go to the screen logic of the maintenace and add a POV.

0 Kudos

I know that i can do this,but the problem is that if you need to regenerate the maintnence ,

you have to remember to rewrite the pov.

0 Kudos

Hi,

So what i think is its better to go for a program( with table control) instead of a table maintenance through which the entry can be made.

0 Kudos

Hi keshav,

Thank you for your response.

I know there are several ways to handle this popup browser.

What i'm looking for is a simple way to handle file choosing , without any "work around".

I think i'll try to build a complex search-help ( with "Search help exit").

Did you use it?

Mybe by overwrite the "hit list display" event , i'll menage to solve my problem.

Thanks,

koby

0 Kudos

Did you use it?

No .. I haven't tried for such a scenario

0 Kudos

Hi,

Never say never....

Sometimes you need to give the customer a flexible search help.

If someday you'll need help on this , call me.

koby

0 Kudos

Hi,

Hope you got the solution.

can you please place it in wiki section.

0 Kudos

Hi Keshav,

I built it!

I made a search help with function-exit.

How do i publish it as a wiki?

The function-exit is:

FUNCTION yf4if_shlp_exit_filepath.

*"----


""Local interface:

*" TABLES

*" SHLP_TAB TYPE SHLP_DESCT

*" RECORD_TAB STRUCTURE SEAHLPRES

*" CHANGING

*" VALUE(SHLP) TYPE SHLP_DESCR

*" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL

*"----


  • EXIT immediately, if you do not want to handle this step

IF callcontrol-step <> 'SELONE' AND

callcontrol-step <> 'SELECT' AND

" AND SO ON

callcontrol-step <> 'DISP'.

EXIT.

ENDIF.

*"----


  • STEP SELONE (Select one of the elementary searchhelps)

*"----


  • This step is only called for collective searchhelps. It may be used

  • to reduce the amount of elementary searchhelps given in SHLP_TAB.

  • The compound searchhelp is given in SHLP.

  • If you do not change CALLCONTROL-STEP, the next step is the

  • dialog, to select one of the elementary searchhelps.

  • If you want to skip this dialog, you have to return the selected

  • elementary searchhelp in SHLP and to change CALLCONTROL-STEP to

  • either to 'PRESEL' or to 'SELECT'.

IF callcontrol-step = 'SELONE'.

  • PERFORM SELONE .........

EXIT.

ENDIF.

*"----


  • STEP PRESEL (Enter selection conditions)

*"----


  • This step allows you, to influence the selection conditions either

  • before they are displayed or in order to skip the dialog completely.

  • If you want to skip the dialog, you should change CALLCONTROL-STEP

  • to 'SELECT'.

  • Normaly only SHLP-SELOPT should be changed in this step.

IF callcontrol-step = 'PRESEL'.

  • PERFORM PRESEL ..........

callcontrol-step = 'SELECT'.

EXIT.

ENDIF.

*"----


  • STEP SELECT (Select values)

*"----


  • This step may be used to overtake the data selection completely.

  • To skip the standard seletion, you should return 'DISP' as following

  • step in CALLCONTROL-STEP.

  • Normally RECORD_TAB should be filled after this step.

  • Standard function module F4UT_RESULTS_MAP may be very helpfull in this

  • step.

IF callcontrol-step = 'SELECT'.

callcontrol-step = 'DISP'.

  • EXIT. "Don't process STEP DISP additionally in this call.

ENDIF.

*"----


  • STEP DISP (Display values)

*"----


  • This step is called, before the selected data is displayed.

  • You can e.g. modify or reduce the data in RECORD_TAB

  • according to the users authority.

  • If you want to get the standard display dialog afterwards, you

  • should not change CALLCONTROL-STEP.

  • If you want to overtake the dialog on you own, you must return

  • the following values in CALLCONTROL-STEP:

  • - "RETURN" if one line was selected. The selected line must be

  • the only record left in RECORD_TAB. The corresponding fields of

  • this line are entered into the screen.

  • - "EXIT" if the values request should be aborted

  • - "PRESEL" if you want to return to the selection dialog

  • Standard function modules F4UT_PARAMETER_VALUE_GET and

  • F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.

IF callcontrol-step = 'DISP'.

  • PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB

  • CHANGING SHLP CALLCONTROL.

TYPE-POOLS shlp.

DATA : i_parameter TYPE shlpfield,

i_shlp_tab TYPE shlp_descr_tab_t ,

i_record_tab TYPE TABLE OF seahlpres WITH HEADER LINE ,

i_shlp TYPE TABLE OF shlp_descr_t WITH HEADER LINE,

i_callcontrol TYPE TABLE OF ddshf4ctrl WITH HEADER LINE.

DATA: gt_filetab TYPE filetable,

gs_file TYPE file_table,

gv_rc TYPE i.

DATA : l_filename TYPE TABLE OF LINKLINE.

****

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

multiselection = space

CHANGING

file_table = gt_filetab

rc = gv_rc.

LOOP AT gt_filetab INTO gs_file.

ENDLOOP.

****

APPEND gs_file-filename TO l_filename.

record_tab[] = l_filename[].

CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'

EXPORTING

parameter = 'FILENAME'

TABLES

shlp_tab = shlp_tab

record_tab = record_tab

CHANGING

shlp = shlp

callcontrol = callcontrol

EXCEPTIONS

parameter_unknown = 1

OTHERS = 2.

IF sy-subrc <> 0.

ENDIF.

callcontrol-step = 'RETURN'.

EXIT.

ENDIF.

ENDFUNCTION.

0 Kudos

Thanks a lot,

in Wiki-ABAP development - you can add to the hierarchy

Former Member
0 Kudos

hi,

DATA : lv_dir TYPE string,

lv_file TYPE string,

lv_result(1) TYPE c.

DATA : lv_filename TYPE string.

PARAMETERS : p_file TYPE rlgrap-filename.

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


>getting f4 help

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = 'P_FILE'

IMPORTING

file_name = p_file.

IF sy-subrc NE 0.

MESSAGE e000.

ENDIF.

AT SELECTION-SCREEN. -


>validating the path

CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

EXPORTING

full_name = p_file

IMPORTING

stripped_name = lv_file

file_path = lv_dir

EXCEPTIONS

x_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL METHOD cl_gui_frontend_services=>directory_exist

EXPORTING

directory = lv_dir

RECEIVING

result = lv_result

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

wrong_parameter = 3

not_supported_by_gui = 4

OTHERS = 5.

IF lv_result IS INITIAL.

MESSAGE 'Invalid Directory' TYPE 'E'.

ENDIF.

CLEAR lv_result.

CALL METHOD cl_gui_frontend_services=>file_exist

EXPORTING

file = lv_file

RECEIVING

result = lv_result

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

wrong_parameter = 3

not_supported_by_gui = 4

OTHERS = 5.

IF lv_result IS INITIAL.

MESSAGE 'Invalid File' TYPE 'E'.

ENDIF.