‎2009 Jul 24 5:31 AM
hi guru,
iam doing some bdc program.. but ity will going to dump on gui_upload.. so plz help me.
An exception occurred that is explained in detail
-
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught in.
procedure "F_UPLOAD_FILE" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The call to the function module "GUI_UPLOAD" is incorrect:
The function module interface allows you to specify only
fields of a particular type under "FILENAME".
The field "P_P_FILE" specified here is a different
field type
-
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-h01.
PARAMETERS: p_file LIKE rlgra-filename
SELECTION-SCREEN : END OF BLOCK b1. .----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f_get_file USING p_file.
-
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
*EXPORTING-
CHANGING
FILE_NAME = p_p_file
endform.
-
form f_upload_file using p_p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = p_p_file
FILETYPE = 'DAT'
endform.
‎2009 Jul 24 5:35 AM
Looks at [this Sample code...|http://www.experts-exchange.com/Database/Software/ERP/SAP_ERP/Q_21278801.html] check where u were doing it wrong..
‎2009 Jul 24 5:35 AM
Looks at [this Sample code...|http://www.experts-exchange.com/Database/Software/ERP/SAP_ERP/Q_21278801.html] check where u were doing it wrong..
‎2009 Jul 24 5:37 AM
Hi,
the type declaration of p_p_file should be string instead of rlgra-filename.
or in the form
form f_upload_file using p_p_file.
data l_file type string. " add this
l_file = p_p_file. " add this
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING FILENAME = p_p_file
FILETYPE = 'DAT'
endform.
‎2009 Jul 24 7:02 AM
HI.. ITS NOT TAKING THE EXCEL AND WORD FILE.. ITS UPLOADING THE GARBAGE VALUE
‎2009 Jul 24 5:38 AM
Hi,
please post the code of GUI_UPLOAD you have used in your program. Seems the dump is due to type mismatch for the file path variable p_p_file.
Regards,
Vik
Edited by: vikred on Jul 24, 2009 6:39 AM
‎2009 Jul 24 5:40 AM
hi manish,
check the data type of file path you are passing to the FM.
PARAMETERS: *p_file* LIKE rlgra-filenametry taking it string...
Regards,
Sumit Nene.
‎2009 Jul 24 5:41 AM
the type of GUI_UPLOAD FM's file name is not matching with p_p_file type. please use same type or it will give error
‎2009 Jul 24 5:44 AM
Hi,
The data type of your file name variable should have been wrong.
DATA: gv_fname TYPE string.
PARAMETERS: p_fpath TYPE RLGRAP-FILENAME. <- Check the data type
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = sy-repid
dynpro_number = syst-dynnr
FIELD_NAME = 'P_FPATH'
IMPORTING
file_name = p_fpath
.
GV_FNAME = P_FPATH.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = GV_FNAME <- Check the data type
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_salesorder
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.
‎2009 Jul 24 6:09 AM
Hi,
Refer the program given below. it is working fine for me.
make the paramerter as:
pa_dfile TYPE rcgfiletr-ftfront.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_dfile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
mask = '(Text file|*.TXT'
CHANGING
file_name = pa_dfile
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID 'PG' TYPE 'E' NUMBER '016'
WITH 'Error in F4 help'(005).
"The provided file is not an excel sheet.
RETURN.
ENDIF.
DATA: lv_filetype(10) TYPE c,
lv_gui_sep TYPE c,
lv_file_name TYPE string.
lv_filetype = 'ASC'.
lv_gui_sep = 'X'.
lv_file_name = pa_dfile.
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_table
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.
Hope it helps.
Regards
Rajesh Kumar
Edited by: Rajesh Kumar on Jul 24, 2009 7:11 AM