02-24-2005 6:17 PM
Hi ,
I am trying to upload a file using GUI_UPLOAD... But sy-subrc 5 is raised which says that it's invalid type ... I have tried using both the DAT as well as the ASC in the filetype line... Can any one help whats wrong in program.
Regards,
-S.
02-24-2005 6:25 PM
Looking at the function module code, the exception is raised two places....
* filetype parameter valid ?
CASE filetype.
WHEN 'BIN' OR 'ASC'.
WHEN OTHERS.
RAISE INVALID_TYPE.
ENDCASE.
So then you can only use 'BIN' or 'ASC'.
You said that you tried 'ASC', so then your exception has to be being raised from the second place which is
call function 'ITS_UPLOAD'
EXPORTING
codepage = codepage
filename = tempfile
filetype = typ
trunclen = read_by_line
IMPORTING
filelength = filelength
TABLES
data_tab = data_tab
EXCEPTIONS
conversion_error = 1
file_read_error = 2
gui_refuse_filetransfer = 3
others = 4.
IF sy-subrc = 1.
RAISE invalid_type.
ELSEIF sy-subrc = 2.
RAISE file_read_error.
ELSEIF sy-subrc = 3.
RAISE gui_refuse_filetransfer.
ELSEIF sy-subrc = 4.
RAISE unknown_error.
ENDIF.
But I believe that this code is only executed when the interface is ITS.
Can you post your code?
Regards,
Rich Heilman
02-24-2005 6:25 PM
Looking at the function module code, the exception is raised two places....
* filetype parameter valid ?
CASE filetype.
WHEN 'BIN' OR 'ASC'.
WHEN OTHERS.
RAISE INVALID_TYPE.
ENDCASE.
So then you can only use 'BIN' or 'ASC'.
You said that you tried 'ASC', so then your exception has to be being raised from the second place which is
call function 'ITS_UPLOAD'
EXPORTING
codepage = codepage
filename = tempfile
filetype = typ
trunclen = read_by_line
IMPORTING
filelength = filelength
TABLES
data_tab = data_tab
EXCEPTIONS
conversion_error = 1
file_read_error = 2
gui_refuse_filetransfer = 3
others = 4.
IF sy-subrc = 1.
RAISE invalid_type.
ELSEIF sy-subrc = 2.
RAISE file_read_error.
ELSEIF sy-subrc = 3.
RAISE gui_refuse_filetransfer.
ELSEIF sy-subrc = 4.
RAISE unknown_error.
ENDIF.
But I believe that this code is only executed when the interface is ITS.
Can you post your code?
Regards,
Rich Heilman
02-24-2005 6:49 PM
Hi,
It's now raising a dump ... & it says
Runtime errors CALL_FUNCTION_CONFLICT_TYPE
Exception CX_SY_DYN_CALL_ILLEGAL_TYPE
& my Code is as follows...
FORM FILE_UPLOAD .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = P_FILE
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_INPUT
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.
V_FLAG = 'X'.
WRITE : 'Error while uploading the file'.
ENDIF.
ENDFORM. " FILE_UPLOAD
Regards,
Seema.
02-24-2005 6:52 PM
02-24-2005 6:59 PM
Hi ,
I have changed it to filetype 'ASC' still its giving dump ... giving the same message...
Runtime errors CALL_FUNCTION_CONFLICT_TYPE
Exception CX_SY_DYN_CALL_ILLEGAL_TYPE
& the input internal table that I have declared is as follows...
*Internal table for the input data.
DATA : BEGIN OF IT_INPUT OCCURS 0,
GRCODE(2) TYPE C,
GL(4) TYPE C,
GLSUF(5) TYPE C,
SUBAC(5) TYPE C,
CORSUF(3) TYPE C,
LOCSUF(3) TYPE C,
PROLIN(4) TYPE C,
END OF IT_INPUT.
Thanx,
-S.
02-24-2005 7:03 PM
Hi Seema!
How about an extended program check. SAP will tell you, which fields have different definition in your program / in function module definition.
Regards,
Christian
02-24-2005 7:09 PM
02-24-2005 7:17 PM
Hi,
I have decalred P_FILE as:-
PARAMETERS : P_FILE LIKE RLGRAP-FILENAME.
Regards,
-S.
02-24-2005 7:20 PM
Ok, you need to pass the GUI_UPLOAD function a field of type STRING. So, in your code.......
Data: yourfile type string.
yourfile = p_file.
call function 'GUI_UPLOAD'
exporting
filename = yourfile
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = it_input
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.
Regards,
Rich Heilman
02-24-2005 7:29 PM
Hey Rich,
I am able to upload the file ... (I checked it up in debug mode)....
Thanx a lot...
Regards,
-S.