2006 Sep 15 5:48 AM
Hi All,
When I am calling the FM: GUI_UPLOAD and passing the FILENAME with the variable declared using PARAMETERS statement. It is throwing the error like " Type Conflict while calling module".
My requirement is to get the File path from the screen field. Could any one mention the error and give the correct code for the same.
I am giving a part of my program below.
PARAMETERS: SOURCE1(25) TYPE c DEFAULT 'D:\TEXT1.TXT'
OBLIGATORY.
data : begin of itext occurs 0,
line(45) type c,
end of itext.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = SOURCE1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITEXT
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.
Regards,
Yellappa.
Hi All,
When I am calling the FM: GUI_UPLOAD and passing the FILENAME with the variable declared using PARAMETERS statement. It is throwing the error like " Type Conflict while calling module".
My requirement is to get the File path from the screen field. Could any one mention the error and give the correct code for the same.
I am giving a part of my program below.
PARAMETERS: SOURCE1(25) TYPE c DEFAULT 'D:\TEXT1.TXT'
OBLIGATORY.
data : begin of itext occurs 0,
line(45) type c,
end of itext.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = SOURCE1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITEXT
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.
Regards,
Yellappa.
2006 Sep 15 5:51 AM
put like this then check.
PARAMETERS :p_file like rlgrap-filename obligatory. "FileRegards
Prabhu
2006 Sep 15 5:52 AM
Always use the file name as this...
<b>PARAMETERS: SOURCE1 TYPE RLGRAP-FILENAME DEFAULT 'D:\TEXT1.TXT'</b>
2006 Sep 15 5:52 AM
i guess it should be like this
PARAMETERS: SOURCE1(25) TYPE rlgrap-filename default 'TEXT1.TXT'
OBLIGATORY.
2006 Sep 15 5:53 AM
hi,
try this:
TYPES : BEGIN OF l_upload,
line(150) TYPE c,
END OF l_upload.
Parameter: P_file(256) type c.
DATA : t_upload TYPE TABLE OF l_upload WITH HEADER LINE,
filename type string.
at selection-screen output.
set cursor field 'PAR'.
filename = p_file.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = filename "'C:\TRY.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = t_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.
regards,
cloud
2006 Sep 15 5:58 AM
HI,
try this code now. check for the bold lines.
it is working fine.
<b>data: fil_name type string.</b>
PARAMETERS: SOURCE1(25) TYPE c DEFAULT 'C:\TEXT1.TXT'
OBLIGATORY.
data : begin of itext occurs 0,
line(45),
end of itext.
start-of-selection.
<b>fil_name = source1.</b>
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
<b>FILENAME = fil_name</b>
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITEXT
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.
Regards,
2006 Sep 15 6:26 AM
Hi
As our friend HRA could spot out the filename should be
declared as <b>type STRING</b>.
Then you will not encounter the dump.
Just FYI, everytime when we call a FM: we have to see
the declaration used in the FM parameters and use
accordingly.
Kind Regards
Eswar
2006 Sep 15 6:33 AM
thank you HRA. I now learnt a new thing . once again thank you and marks are awarded for the same. The way you answered is good like highlighing the required point so that others can easily go through.
regards,
yellappa.
2006 Sep 15 5:59 AM
I tried for the same but still it is giving the same error.My complete program look like this.Instead of using parameters if i specify the file name directly it is working, like FILENAME = 'D:\text1.txt'. please check this program.
PARAMETERS: SOURCE1 TYPE RLGRAP-FILENAME DEFAULT 'D:\TEXT1.TXT'
obligatory,
SOURCE2 TYPE rlgrap-filename DEFAULT 'D:\TEXT2.TXT'
OBLIGATORY,
DESTIN TYPE rlgrap-filename DEFAULT 'D:\RESULT.TXT'
OBLIGATORY.
data : begin of itab1 occurs 0, "Main text file
name(20) type c,
code(12) type c,
mailid(30) type c,
end of itab1.
data : begin of itab2 occurs 0, "code text file
code(60) type c,
end of itab2.
data : begin of itext occurs 0,
line(45) type c,
end of itext.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = SOURCE1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITEXT
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.
Loop at itext. "//itab1 now has all the fields
split itext-line at '|' into itab1-NAME ITAB1-CODE ITAB1-mailid.
append itab1.
endloop.
REFRESH ITEXT.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = SOURCE2
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITEXT
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.
Loop at itext. "// now itab2 has all the code fields
move itext-line(12) to itab2-code.
append itab2.
endloop.
End-of-selection.
sort itab2.
sort itab1 by code.
loop at itab1.
clear itab2.
read table itab2 with key code = itab1-code.
check sy-subrc <> 0.
delete itab1.
endloop.
REFRESH ITEXT.
LOOP AT ITAB1.
CONCATENATE ITAB1-NAME ITAB1-CODE ITAB1-mailid INTO ITEXT-LINE SEPARATED
BY '|'.
APPEND ITEXT-LINE TO ITEXT.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = DESTIN
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = '|'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITEXT
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2006 Sep 15 6:23 AM
PARAMETERS:SOURCE2 like rlgrap-filename DEFAULT 'D:TEXT2.TXT'
OBLIGATORY.
data : file type string.
file = SOURCE2.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = file
...........
2006 Sep 15 6:25 AM
Hi,
Instead of declaring like :
data: fil_name type string.
you need to declare like :
data: fil_name like rlgrap-filename value 'D:\TEXT1.TXT'.
It will solve the problem
Cheers,
Vikram
Pls reward for helpful replies!!
2006 Sep 15 6:37 AM
Could u please explain the difference between using
fil_name type string and
fil_name like rlgrap-filename value 'D:\text1.txt'.
which one would be better and why
regards,
yellappa
2006 Sep 15 6:42 AM
Hi
As mentioned in my earlier post, we have to check the
declarations used in the FM whichever we are using and
need to declare in the same manner.
If you see the datatype of RLGRAP-FILENAME, itz of
character type length 128 characters. Whereas STRING is
a sequence of characters and different data type.
Kind Regards
Eswar
2006 Sep 15 6:56 AM
hi, probably the error may be with the file type u r passing. as mentioned above file should be of type rlgrap-filename.
any way y dont u see the dump documentation, and see where the error is poiting aith an arrow in the code. also read the error analysis.
if u find out type conflict with any parameter that is passed to the function module,
go to se37, enter into the function module gui_upload and see parameter of what type is there
now declare the passing paramter as of the same type and then run.
if u get any short dump like this, this is the way u need to proceed.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |