Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

open dataset

Former Member
0 Likes
663

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

4 REPLIES 4
Read only

Former Member
0 Likes
613

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

Read only

Former Member
0 Likes
613

hi

the file contains japanese characters which cannot convert character error was occured.

any idea

thanks

Read only

Former Member
0 Likes
613

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

Read only

Former Member
0 Likes
613

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