2007 Jun 30 10:32 AM
hi,
i am getting this error
You cannot convert the character set.
While a text was being converted from code page '4110' to '4103', one of
the following occurred:
OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc EQ 0.
DO.
READ DATASET v_file INTO i_file. ---> goes to dump here
any idea
rgds
madhu
hi,
i am getting this error
You cannot convert the character set.
While a text was being converted from code page '4110' to '4103', one of
the following occurred:
OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc EQ 0.
DO.
READ DATASET v_file INTO i_file. ---> goes to dump here
any idea
rgds
madhu
2007 Jun 30 11:00 AM
hi,
this might healp you out
open data set 'chan.txt' for input in text mode encoding default.
do.
read data set 'chan.txt' into <b>table</b> itab.
if sy-subrc = 0 .
append itab.
clear itab.
else.
exit.
endif.
enddo.
close data set 'chan.txt'.
Message was edited by:
maruvada phanindra
2007 Jun 30 12:13 PM
Hi,
I think the problem is coming because of the declaration of i_file.
You haven't mentioned how u declared this field.
If it is a table then it is totally wrong.
Please read the folowing.
i_file can be a field, a string, a structure, or a flat structure. A syntax error is triggered if i_file is defined as a deep structure, table, or reference. Internal tables must therefore always be transferred line by line, for example, in a DO loop that is exited using EXIT.
The way in which the file was opened during the statement OPEN DATASET determines how records are read from it afterwards.
If the file was opened in text mode (addition IN TEXT MODE or IN LEGACY TEXT MODE beim OPEN DATASET), the system assumes that the file is structured line by line. Accordingly, read commands always refer to one line. Line separators are viewed as structuring units and therefore automatically filtered. Length specifications always refer to the number of characters (although in non-unicode systems, multi-byte characters are counted in the length of their memory representation).
If the file was opened in binary mode (addition IN BINARY MODE or IN LEGACY BINARY MODE with OPEN DATASET), the system expects an unstructured sequence of bytes. Length specifications accordingly refer to the number of bytes.
The number of characters or bytes read by calling READ DATASET depends, on the one hand, on the opening mode of the file, and, on the other hand, on the type of target field f:
With text files, an entire line is always imported, and this is then transferred to the target field f. If this target field is shorter than the number of read characters, the excess characters are lost. Since fields of the type STRING have unlimited length, a STRING always gives a full line as target field. If the file was opened in TEXT MODE and if the character representation in the file is UTF-8, then only character-like fields (C, N, D, T), strings, and purely character-like structures are allowed for f. This check takes place at runtime.
If the file was opened in binary mode, the size of the target field f determines how many bytes are to be imported. Since fields of the type XSTRING have unlimited length, importing to a XSTRING means that the entire file is imported. To prevent this, you can use the addition ... MAXIMUM LENGTH.
If data of a length less than the target field f is imported, the target field is filled with blanks in the case of files in text mode and, in the case of files in binary mode, with hexadecimal zeros. Less data can occur, for example, if the file end has been reached or if you have text files, and the current line is shorter than the target field.
The Return Code is set as follows:
SY-SUBRC = 0:
A record from the file was read.
SY-SUBRC = 4:
The end of the file has been reached.
Example
DATA: line TYPE string,
file(20) TYPE C value '/usr/test.dat'.
OPEN DATASET file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
DO.
READ DATASET file INTO line.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE: / line.
ENDDO.
The file test.dat is imported line by line and then output. As soon as the end of the file test.dat is reached, the system exits the DO loop.
So in do loop first transfer to the structure and keep on appending to your internal table i_file.and please keep the sy-subrc check that is mentioned in the above example.
Reward points if useful.
Regards,
sasi
Message was edited by:
sasidhar yalamanchili
2007 Jul 02 9:13 AM
hi sasi
OPEN DATASET v_file FOR INPUT IN binary mode .
IF sy-subrc EQ 0.
do.
read dataset v_file into l_content_in maximum length 600.
if sy-subrc <> 0.
exit.
else.
v_file1-content = l_content_in.
append v_file1.
endif.
enddo.
close dataset v_file.
after this how to convert it back. because the file contains FFFE30003...etc.
thanks for your reply
Madhu