2007 Jun 11 9:13 AM
plz check bellow code
PARAMETERS: p_fname TYPE localfile.
calling upload
EXPORTING
FILENAME = p_fname
FILETYPE = 'DAT'
TABLES
DATA_TAB = itab.
ENDFORM.
if i pass filename (p_fname) to parameter i am not getting the output path to select the file plz give me proper suggestion .
2007 Jun 11 9:21 AM
Hi,
If you want popup to come for selecting the file name from your pc,you can use ws_filename_get function module in at selection-screen on value-request.
PARAMETERS: p_fname LIKE rlgrap-filename.
CONSTANTS : c_0 TYPE c VALUE '0',
c_mask(5) TYPE c VALUE ',..'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = p_fname
mask = c_mask
mode = c_0
title = 'FIlename'
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
plz check bellow code
PARAMETERS: p_fname TYPE localfile.
calling upload
EXPORTING
FILENAME = p_fname
FILETYPE = 'DAT'
TABLES
DATA_TAB = itab.
ENDFORM.
if i pass filename (p_fname) to parameter i am not getting the output path to select the file plz give me proper suggestion .
2007 Jun 11 9:18 AM
Hello ,
Try this one.
PARAMETERS: FILENAME LIKE EPSF-EPSDIRNAM.
DATA: FILENAME LIKE RLGRAP-FILENAME.
FILENAME = P_FILENAME.
CLEAR P_RC.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = FILENAME
FILETYPE = 'ASC'
* HEADLEN = ' '
* LINE_EXIT = ' '
* TRUNCLEN = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* DAT_D_FORMAT = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = P_ITAB_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
.
IF SY-SUBRC <> 0.
P_RC = SY-SUBRC.
ENDIF.Regards,
Vasanth
2007 Jun 11 9:18 AM
hi,
U need to declare the filename as
p_fname like rlgrap-filename.
Then it will work for the localfile.
2007 Jun 11 9:19 AM
HI,
U should decalre file name like
PARAMETERS: P_NAME LIKE rlgrap-filename.
Then pass the parameter to FM
rewards points if help full
Regards
Suresh.D
2007 Jun 11 9:20 AM
Hi,
Use p_fname like rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
FIELD_NAME = PATH
IMPORTING
FILE_NAME = P_FNAME.Hope this helps.
Regards,
Richa
2007 Jun 11 9:21 AM
Hi,
If you want popup to come for selecting the file name from your pc,you can use ws_filename_get function module in at selection-screen on value-request.
PARAMETERS: p_fname LIKE rlgrap-filename.
CONSTANTS : c_0 TYPE c VALUE '0',
c_mask(5) TYPE c VALUE ',..'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = p_fname
mask = c_mask
mode = c_0
title = 'FIlename'
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
2007 Jun 11 10:08 AM
Hi Anil,
Try this. Hope this is what you need.
DATA: IT_TAB TYPE FILETABLE,
GD_SUBRC TYPE I. " For string return code
******************Selection screen definition*************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
************************************************************************
****lOGIC FOR OPENING TEXT FILE AND STORING IT IN INTERNAL TABLE*****
************************************************************************
***********************AT SELECTION-SCREEN***************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
REFRESH: IT_TAB.
*Opens File Open Dialog Box for selecting input file.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Select File'
DEFAULT_FILENAME = '*.txt'
MULTISELECTION = ' '
CHANGING
FILE_TABLE = IT_TAB
RC = GD_SUBRC.
Loop on the internal table and get the file name
LOOP AT IT_TAB INTO P_FILE.
EXIT. " Loop only once
ENDLOOP.
At the end of execution....the parameter p_file will contain the address of the local file that you selected through the interactive screen.
Reward Pts if helpful.
Regards,
Kirti Bhushan
2007 Jun 11 10:15 AM
Hi,
CALL FUNCTION 'F4_FILENAME' "For upload of the program
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
Regards
null
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |