‎2007 Jul 02 7:42 AM
hi,
can anyone tell me how to read a unicode file from application server using open data set.
i am using OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING default, which goes to dump.
thanks,
Madhu
‎2007 Jul 02 7:44 AM
Hi,
Check this sample code...
DATA:
len TYPE i,
text(30) type c,
dir(30) TYPE c VALUE '/tmp/test.txt'.
DATA: begin of data OCCURS 0,
matnr type matnr,
werks type werks_d,
end of data.
START-OF-SELECTION.
CLEAR: text.
OPEN DATASET dir FOR INPUT IN TEXT MODE.
DO.
READ DATASET dir INTO text.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
SPLIT TEXT AT '|' INTO DATA-MATNR DATA-WERKS.
APPEND DATA.
ENDDO.
WRITE: / text.
CLOSE DATASET dir.
<b>Reward points</b>
Regards
‎2007 Jul 02 7:50 AM
hi
the file contains japanese characters which cannot convert character error was occured.
any idea
thanks
‎2007 Jul 02 7:56 AM
Hi,
Look at the beow link
http://www.s001.org/ABAP-Hlp/abapopen_dataset.htm
Use the BINARY Mode to convert the Japanies charecters
Regards
Sudheer
Message was edited by:
Sudheer Junnuthula
‎2007 Jul 02 8:02 AM
hi
if i use binary mode only first line it reads.but the file has many lines. if i put it in xstring all datas will read and put together.how to split it accordingly.
data v_file1 type xsrting.
OPEN DATASET v_file FOR INPUT IN binary mode.
read dataset v_file into v_file1.
v_file1 has all records ,how to split line wise.
please guide me