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 line by line with different line size - is that possible?

Former Member
0 Kudos

Hi all,

I have a problem. I want to read a dataset which looks like that (first three data records):

0.

dmowort_wa-ankettdate = datei_inhalt1+start(laenge).

ENDIF.

...

ENDDO.

Does anybody know what I mean?!? Maybe I described the problem not good enough...

Thank you,

Judith

Edited by: BW4us on Sep 13, 2010 5:48 PM

8 REPLIES 8

Former Member
0 Kudos

Hi

Define your internal table as below :-



DATA : ITAB TYP TABLE OF STRING.

.

So that ITAB will have string of variable length.

Regards

Abhii

0 Kudos

Hi,

I don't understand your hint - I can't use an internal table, because I don't always get the same fields. Or did you mean, that in the next step I'll have to search in this internal table!?

-> anyway, I can't read into this itab, failure message when checking the code (can't activate the coding now)

READ DATASET datei1 INTO itab.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.


    Programm ...
"ITAB" darf keine Tabelle sowie keine Referenz sein und diese oder
Strings auch nicht beinhalten.

thx

Judith

Edited by: BW4us on Sep 13, 2010 6:22 PM

0 Kudos

What I wanted to say was, According to my understanding of your issue, You were getting a string of variable (length) content every time & that you have defined the string length fixed, you were not able to get the desired output. So I suggested the above Internal table declaration so that it will have a string of variable length for each iteration.

Regards

Abhii

SuhaSaha
Advisor
Advisor
0 Kudos

Hey Judith,

What Abhii is trying to put across is instead of defining your table as:

DATA: BEGIN OF datei_inhalt1,
satz(1200),
END OF datei_inhalt1.

Declare it as :

DATA: BEGIN OF datei_inhalt1,
satz TYPE string,
END OF datei_inhalt1.

Anyway there are many threads in the forum on reading an XML file from app server which you can refer.

BR,

Suhas

Former Member
0 Kudos

Thanks Dada for making it clear...

Regards

Abhii

brad_bohn
Active Contributor
0 Kudos

But STRING is not likely to solve whatever your issue is unless you've got some really long records not shown or there aren't any record delimiters in the file. What exactly doesn't work? The '1200' length specification is easily long enough to fit all 3 of those sample records. What error are you encountering???

Former Member
0 Kudos

My problem is, that the the records get shifted each time, because they are not 1200 signs long - so the first record comes completely into the workarea (with a bit of next one), the second one is missing a view parts and so on, until I only have fragments of the records I originally wanted to have.

Former Member
0 Kudos
Hey Judith,

What Abhii is trying to put across is instead of defining your table as:
DATA: BEGIN OF datei_inhalt1,
satz(1200),
END OF datei_inhalt1.


Declare it as :
DATA: BEGIN OF datei_inhalt1,
satz TYPE string,
END OF datei_inhalt1.


Anyway there are many threads in the forum on reading an XML file from app server which you can refer.

BR,
Suhas

That leads to the same error message: "DATEI_INHALT1" darf keine Tabelle sowie keine Referenz sein und diese

oder Strings auch nicht beinhalten.