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: 

FM for file upload

Former Member
0 Kudos

Is there a Function module in se37 which will ask user to enter the filepath from where a file has to be uploaded?

10 REPLIES 10

former_member195383
Active Contributor
0 Kudos

KD_GET_FILENAME_ON_F4

use this FM...

the below method can also be used for the same purpose...

CALL METHOD cl_guid->directory_browse

EXPORTING window_title = 'Test'

CHANGING selected_folder = wf_path2.

CALL METHOD cl_gui_cfw=>flush.

Reward points if helpful..

Edited by: Rudra Prasanna Mohapatra on Jul 4, 2008 8:48 AM

Edited by: Rudra Prasanna Mohapatra on Jul 4, 2008 8:51 AM

0 Kudos

How to get the file path to be entered as a pop -up on the screen as it happens in downloading of file ..

Is there any FM for this purpose?

sachin_mathapati
Contributor
0 Kudos

F4_FILENAME

<removed by moderator>

Edited by: Mike Pokraka on Aug 4, 2008 9:36 AM

Former Member
0 Kudos

Use the FM: 'F4_FILENAME'

Regards

Kannaiah

0 Kudos

hi ,

As one of my colleague (Kannaiah Kavuri )

said, it is 'F4_FILENAME'.

Former Member
0 Kudos

Hi Shweta,

You can even make use of WS_FILENAME_GET to get the F4 help for file available in Presentation server.

<removed by moderator>

Thanks,

Asha

Edited by: Mike Pokraka on Aug 4, 2008 9:36 AM

Former Member
0 Kudos

hi,

please refer the following code.

selection-screen: begin of block b1 .

parameters : p_file type rlgrap-filename.

selection-screen: end of block b1 .

at selection-screen on value-request for p_file.

perform get_f4 changing p_file.

form: get_f4 changing g_file type rlgrap-filename.

data : s_file type ibipparms-path.

call function 'F4_FILENAME'

exporting

program_name = syst-cprog

dynpro_number = syst-dynnr

importing

file_name = s_file.

g_file = s_file. .

endform.

hope it is useful.

regards,

sreelakshmi.

Former Member
0 Kudos

Hi,

plz check this work for you.

FORM get_filename .

*Select File For Upload

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = c_title
      multiselection          = abap_false
    CHANGING
      file_table              = it_filename
      rc                      = v_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.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

  CLEAR p_file.

*Reading a table it_filename.
  READ TABLE it_filename INTO wa_filename INDEX 1.

  p_file = wa_filename-filename.

ENDFORM.                    " get_filename

<removed by moderator>

thanks,

dhanashri.

Edited by: Mike Pokraka on Aug 4, 2008 9:36 AM

Former Member
0 Kudos

Use this code which is used rarely.

It has the flexibility to select the file from application as well as presentation.

Please reward if useful.

==========

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

PERFORM GET_FILE_DETAILS. " File selection using F4

FORM GET_FILE_DETAILS .

DATA : PATH LIKE DXFIELDS-LONGPATH.

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = ' '

I_SERVER = '?'

IMPORTING

O_PATH = PATH.

P_FILE = PATH.

IF SY-SUBRC <> 0.

WRITE:/ TEXT-007. " Error in File selection. File could not be selected.

ENDIF.

ENDFORM. " GET_FILE_DETAILS

rainer_hbenthal
Active Contributor
0 Kudos

F4_FILENAME has the disadvantage of supporting only 128 characters. Espacially UNC path con be quiete longer.

Better use cl_gui_frontend_services=>file_open_dialog