Application Development 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 DATASET. results in out of memory!!

Former Member
0 Kudos

Hi all,

Im reading from a large textfile on the Applivcation Server using

OPEN DATASET IN TEXT MODE

and

READ DATASET

But at the first read i get a shortdump saying that the process is out of memory. it seems that the READ DATASET tries to read the whole file.

Maybe this is beacuse it doesnt recognise the Linefeed used in the file.

any suggestions how to proceed?

thanks

Joris

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Regarding the line feed characters: Are you reading files from a different operating system (i. e. reading a UNIX file from a windows box)? If so, you have to watch out for code conversion issues such as LF vs. CR/LF...

Regards, Joerg

7 REPLIES 7

Former Member
0 Kudos

Hi,

You can try to use LENGTH <len> parameter.

Reward if useful!

Former Member
0 Kudos

Hi,

Regarding the line feed characters: Are you reading files from a different operating system (i. e. reading a UNIX file from a windows box)? If so, you have to watch out for code conversion issues such as LF vs. CR/LF...

Regards, Joerg

0 Kudos

Hi,

i've trie dthe LENGTH parameter, no luck. It still crashes at the first call to READ DATASET.

The file i'm trying to read is the Import file from LSMW ( xxxxx.lsmw.read ). I've downloaded it to my pc manually. It shows up on my pc all mangled up. See how it has extra spaces like unicode? how is that possible? both server and pc are unicode...

ML S M W L I M A _ F 1 D M S 4 C R _ F I L E S _ N E W N E D 2 1 0 2 0 0 7 0 7 2 4 1 8 4 3 3 7 J B O sD O C I N F O R E C O R D I N F O R M A T I O N 2 0 0 0 0 7 0 4 S T U K L I J S T B E S T A A T U I T 4 B L A D E N 3 0 2 8 0 0 0 2 4 0 0 1 A S T L 0 3 AF I L E S _ I N _ D O C _ I N F O _ R E C O R D 3 0 2 8 0 0 0 2 4 _ s t 0 0 0 _ a _ 1 . p d f P D F 3 0 2 8 0 0 0 2 4 0 0 1 A S T L AF I L E S _ I N _ D O C _ I N F O _ R E C O R D 3 0 2 8 0 0 0 2 4 _ s t 0 0 0 _ a . d o c D O C 3 0 2 8 0 0 0 2 4 0 0 1 A S T L IC L A S S A L L O C A T I O N L I M A _ D M S _ 1 3 0 2 8 0 0 0 2 4 0 0 1 A S T L sD O C I N F O R E C O R D I N F O R M A T I O N 2 0 0 0 0 7 0 4 S T U K L I J S T B E S T A A T U I T 4 B L A D E 3 0 2 8 0 1 0 7 7

0 Kudos

Hi Joris,

There might really be some code conversion issues. How did you open the file on your PC? With notepad or another text editor? Or using e. g. EXCEL.

Which format are you expecting? CSV or fixed length?

How is the file written? From LSMW or an external program?

Regards, Joerg

0 Kudos

Joerg,

Thanks for the quick reply.

The file was created by LSMW (during the READ stage)

I downloaded it with Tx. CG3Y

Now here is something.

I tried opening it with NotePad++... but it crashed!!

Normal NotedPad could open it, and the file shows up like the sample i send.

I expect/would like a file with cr/lf so i can read it with READ DATASET easily.

is there a way to heck what codepage a file is in on the A.S. ?

Thanks alot!

Joris

0 Kudos

Hi Joris!

Hm. I'm afraid I'm just guessing at the moment...

But do your PC and the A.S. have a different OS?

Did you choose option "BIN" or "ASC" in transaction CG3Y? I understand your file is an ASCII file, right? So I guess you'd have to choose "ASC".

Did you give the ENCODING DEFAULT option in your ABAP program when doing the OPEN DATASET?

Did you use the MAXIMUM LENGTH parameter in your READ DATASET command? You can always check how many characters were read with the LENGTH option...

Hope this helps,

Joerg

Former Member
0 Kudos

Hi all,

I solved it.

The LSMW files (*.lsmw.read) are in a special internal format.

I somehow assumed that these files are flat textfiles.

But in fact it is a file with for each line a Hex. value for its length.

so no CR/LF...

i used this code to read it (simplyfied)

It can be used to read LSMW read files:


OPEN DATASET fbron FOR INPUT IN BINARY MODE.

  DATA: l_hexreclen(4) TYPE x,
        l_reclen TYPE i,
        l_max_buffer(5000).
do
    READ DATASET fbron INTO L_HEXRECLEN.           " read <b>length</b> of next data line
    IF SY-SUBRC <> 0. EXIT. ENDIF.

    L_RECLEN = L_HEXRECLEN.            "move to i
    IF L_RECLEN = 0 OR L_RECLEN > 5000.  some checks
      "todo
    ENDIF.
    ASSIGN L_MAX_BUFFER(L_RECLEN) TO <BUFFER>.  "assign FS up to <length> chars
    READ DATASET Fbron INTO <BUFFER>.                      " read data line
    IF SY-SUBRC <> 0.
   RAISE EXCEPTION TYPE cx_sy_range_out_of_bounds.   " raise err. to end loop
    ENDIF.
enddo.

Joerg, some points rewarded for you help, it was appreciated!

regards,

Joris Bots

Message was edited by:

Joris Bots