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 FOR DOWNLOAD

Former Member
0 Kudos

hai

I need to get a f4 help for download path parameter. if i click f4 on parameter it need to ask me path to save instead of path to open.

regards

6 REPLIES 6

Former Member
0 Kudos

Hello,

Use this.


PARAMETERS: P_FILE TYPE RLGRAP-FILENAME OBLIGATORY.
*--- Value Request for the file name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  CALL FUNCTION 'F4_FILENAME'
       EXPORTING
            FIELD_NAME = 'PATH'
       IMPORTING
            FILE_NAME  = P_FILE.

Cheers,

Vasanth

Former Member
0 Kudos

write as below ...

parameters:p_file like rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_PATH = P_FILE

MASK = ',..'

MODE = '0 '

TITLE = 'Choose File'

IMPORTING

FILENAME = P_FILE

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

Former Member
0 Kudos

PARAMETERS: P_PSFILE TYPE LOCALFILE DEFAULT TEXT-051,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PSFILE.

PERFORM F4_GET_FILE_NAME USING TEXT-132

CHANGING GV_FILENAME P_PSFILE.

FORM F4_GET_FILE_NAME USING P_DEFAULTPATH TYPE STRING

CHANGING P_LV_FILENAME TYPE STRING

P_FILENAME TYPE LOCALFILE.

DATA : LV_RC TYPE SY-SUBRC,

LV_INIT_DIR TYPE STRING,

LT_FILETABLE TYPE FILETABLE,

LS_FILETABLE LIKE LINE OF LT_FILETABLE.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = 'Select File and Path'

DEFAULT_EXTENSION = 'XLS'

DEFAULT_FILENAME = 'Vendor_Lot_Data'

FILE_FILTER = '*.XLS'

  • WITH_ENCODING =

INITIAL_DIRECTORY = P_DEFAULTPATH

  • MULTISELECTION =

CHANGING

FILE_TABLE = LT_FILETABLE

RC = LV_RC

  • USER_ACTION =

  • FILE_ENCODING =

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

OTHERS = 5 .

LV_RC = SY-SUBRC.

IF LV_RC <> 0.

MESSAGE 'File Path Not Found' TYPE 'I'.

ELSE.

READ TABLE LT_FILETABLE INTO LS_FILETABLE INDEX 1.

FREE LT_FILETABLE.

P_FILENAME = LS_FILETABLE-FILENAME.

ENDIF.

P_LV_FILENAME = P_FILENAME.

ENDFORM. " F4_GET_FILE_NAME

Former Member
0 Kudos

Check this code..


PARAMETER p_infile LIKE rlgrap-filename DEFAULT 'C:\TEMP\DATA.XLS'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_infile.
  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      mask            = '*.*,*.*.'
    IMPORTING
      filename        = p_infile
    EXCEPTIONS
      selection_cancel = 3
      OTHERS          = 5.
  IF sy-subrc EQ 3.
      "message
  ENDIF.

Former Member
0 Kudos

hi

good

Function module is F4IF_FIELD_VALUE_REQUEST.

Use the Function moduel like this in this i create screen 100 by using se51.

REPORT zcl_f4_help.

TYPES: BEGIN OF values,

carrid TYPE spfli-carrid,

connid TYPE spfli-connid,

END OF values.

DATA: carrier(3) TYPE c,

connection(4) TYPE c.

DATA: progname TYPE sy-repid,

dynnum TYPE sy-dynnr,

dynpro_values TYPE TABLE OF dynpread,

field_value LIKE LINE OF dynpro_values,

values_tab TYPE TABLE OF values.

CALL SCREEN 100.

MODULE init OUTPUT.

progname = sy-repid.

dynnum = sy-dynnr.

CLEAR: field_value, dynpro_values.

field_value-fieldname = 'CARRIER'.

APPEND field_value TO dynpro_values.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE value_carrier INPUT.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

tabname = 'DEMOF4HELP'

fieldname = 'CARRIER1'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'CARRIER'.

ENDMODULE.

MODULE value_connection INPUT.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = progname

dynumb = dynnum

translate_to_upper = 'X'

TABLES

dynpfields = dynpro_values.

READ TABLE dynpro_values INDEX 1 INTO field_value.

SELECT carrid connid

FROM spfli

INTO CORRESPONDING FIELDS OF TABLE values_tab

WHERE carrid = field_value-fieldvalue.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CONNID'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'CONNECTION'

value_org = 'S'

TABLES

value_tab = values_tab.

ENDMODULE.

thanks

mrutyun^

Former Member
0 Kudos

hi,

use the FM F4_FILENAME or the method.

CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG.

Regards,

Priya.