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: 

F4 Help

Former Member
0 Kudos

Hi Friends,

I have to give F4 help option for file path parameter. Is there any way that in F4 help I can make the file type as by default excel format so that the user can always export data to an excel sheet.

Thanks in Advance,

Meenu.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

The FM : 'KD_GET_FILENAME_ON_F4' is not taking the filename as by default excel format.

If we specify the filename.XLS then only it is working. My requirement is to take it by deafult into excel format.

11 REPLIES 11

Former Member
0 Kudos

you can use the below class

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = lf_file

filetype = 'EXCL'

IMPORTING

filelength = lf_filelength

CHANGING

data_tab = lt_datatab

EXCEPTIONS

OTHERS = 1.

former_member203501
Active Contributor
0 Kudos

hi do like this..

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

i_location_flag = 'A'

  • I_SERVER = '?'

  • I_PATH =

filemask = '*.xls'

  • FILEOPERATION = 'R'

IMPORTING

  • O_LOCATION_FLAG =

  • O_SERVER =

o_path = filename

  • ABEND_FLAG =

EXCEPTIONS

rfc_error = 1

error_with_gui = 2

OTHERS = 3.

Former Member
0 Kudos

OOps use the method

FILE_SAVE_DIALOG

Former Member
0 Kudos

Hi,

Check this method CL_GUI_FRONTEND_SERVICES->FILE_OPEN_DIALOG

CL_GUI_FRONTEND_SERVICES->FILE_SAVE_DIALOG

CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      window_title      = 'Select archivo'
      default_extension = 'xls'
      file_filter       = '*.xls'
    CHANGING
      filename          = filename
      path              = path
      fullpath          = fullpath.

  IF sy-subrc EQ 0.
    p_file = fullpath.
  ENDIF.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      initial_directory = directory
      file_filter       = '*.xml'    " EC-NOTEXT
      multiselection    = ' '
    CHANGING
      file_table        = filetable
      rc                = rc.
  IF rc = 1.
    READ TABLE filetable INDEX 1 INTO line.
    filename = line-filename.
  ENDIF.

Former Member
0 Kudos

Hi,

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

PROGRAM_NAME = SY-REPID

DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = file_name

CHANGING

FILE_NAME = FILE_NAME

EXCEPTIONS

MASK_TOO_LONG = 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.

Hope it helps!!

Regards,

Pavan

Former Member
0 Kudos

Hi,

Use FM CALL FUNCTION 'KD_GET_FILENAME_ON_F4'


CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
   EXPORTING
   PROGRAM_NAME        = SYST-REPID
    DYNPRO_NUMBER       = SYST-DYNNR
    FIELD_NAME                 = <Field-Name>
     STATIC              = 'X'
    MASK                = '*.XLS, *.xls'
    CHANGING
      FILE_NAME           = P_INPUT
 EXCEPTIONS
   MASK_TOO_LONG       = 1
*   OTHERS              = 2

Former Member
0 Kudos

I have used the FM :WS_FILENAME_GET for F4 help and GUI_DOWNLOAD to export data. I ahve to give user the option to specify file name and path. So while specifying the file name itself i want to make the file type option as excel format.

Former Member
0 Kudos

hi

hope it will help u

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PFNAME.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

STATIC = 'X'

CHANGING

FILE_NAME = PFNAME.

~linganna

Former Member
0 Kudos

Hi Meenu,

Try this

create parameter as below

PARAMETERS:fname LIKE rlgrap-filename DEFAULT ''.

then call the following function in your program

AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

  • FIELD_NAME = FNAME

IMPORTING

file_name = fname.

then pass the value "fname' where required.

Regards.

Amol

Former Member
0 Kudos

The FM : 'KD_GET_FILENAME_ON_F4' is not taking the filename as by default excel format.

If we specify the filename.XLS then only it is working. My requirement is to take it by deafult into excel format.

0 Kudos

HI,

Check these Method's

CL_GUI_FRONTEND_SERVICES->FILE_OPEN_DIALOG

CL_GUI_FRONTEND_SERVICES->FILE_SAVE_DIALOG

You can pass the extension while calling these methods and When you see the Pop-Up the File type selected will be the one you passed to these methods.

Please check my above post ..