on 04-03-2008 9:39 AM
Hi,
I have used the function module 'GUI_UPLOAD' to upload the data from a flat file into internal table.But after executing the program it is giving information message as 'WRONG PARAMETER:FILE_NAME' before showing the o/p.Why is this happening?
Hi,
please check the below example... and cross check where ur commiting mistake.....
*&---------------------------------------------------------------------*
* SELECTION-SCREEN
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_path LIKE rlgrap-filename.
SELECT-OPTIONS : s_role FOR agr_define-agr_name.
SELECTION-SCREEN END OF BLOCK b1.
*======================================================================*
* A T S E L E C T I O N - S C R E E N
*======================================================================*
AT SELECTION-SCREEN.
IF p_path IS INITIAL
AND s_role IS INITIAL.
MESSAGE i020(yxxx) WITH text-002.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
IF s_role IS INITIAL.
PERFORM f_get_file_name CHANGING p_path.
ENDIF.
*&---------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
IF s_role IS INITIAL.
PERFORM f_upload_file.
ENDIF.
PERFORM delete_roles.
PERFORM results.
*&---------------------------------------------------------------------*
*& Form f_get_file_name
*&---------------------------------------------------------------------*
FORM f_get_file_name CHANGING p_p_path.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_p_path.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f_get_file_name
*&---------------------------------------------------------------------*
*& Form f_upload_file
*&---------------------------------------------------------------------*
FORM f_upload_file .
DATA: path TYPE string.
path = p_path.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = path
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_upload.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " f_upload_file
feel free to contact me if still problem is not solved...
Regards,
Sreenivasa sarma K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
write like this , it may help u
SELECTION-SCREEN BEGIN OF BLOCK blk3 WITH FRAME TITLE text-019.
PARAMETERS : pa_fname TYPE localfile default 'C:\ASS_REV.TXT'.
SELECTION-SCREEN END OF BLOCK blk3.
data : lv_fname TYPE STRING.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_fname.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'PA_FNAME'
IMPORTING
file_name = pa_fname.
start-of-selection.
lv_fname = pa_fname.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_fname
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = RECORD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
reward if helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
l_filename should be a string.
l_filename = p_input.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_data
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.