Skip to Content
-1

reading the data from sap table which has field name SString.

Feb 20, 2017 at 03:54 PM

178

avatar image
Former Member

Hi,

I have created a table. and have one field called "name" which has sstring datatype.

now I am trying to create the internal table for this.

while activating this code the error I am getting is " "table name' must be a flat structure. You cannot use internal tables, strings, references, or structures as components"

what is the reason of this error.

below is my code snippet

types:begin of t_zanshu2.

include structure zanshu2.

types: end of t_zanshu2.

data: it_anshu type standard table of t_zanshu2 initial size 0,

wa_anshu type t_zanshu2.

where zanshu2 is a table which has 3 field

zid(50) NUM

zname(245) sstring

zadd (255) char

10 |10000 characters needed characters left characters exceeded
Former Member

any other approach will be fine for creating an internal table, please share if you know

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sandra Rossi Jun 02, 2017 at 09:07 PM
0

INCLUDE STRUCTURE is very old and almost obsolete (and also INCLUDE TYPE, as said in the ABAP documentation).

INCLUDE STRUCTURE accepts only flat structures, because it's the way how the word "STRUCTURE" works in statements for typing parameters (FORM and FUNCTION).

You may use INCLUDE TYPE instead.

PS: sorry to resurrect this OLD question, but I was wondering why INCLUDE STRUCTURE behaved this way, the official ABAP documentation is not clear.

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Sandra, what is unclear to you?

0

Thanks Horst. I couldn't find a clear explanation about the fact that INCLUDE STRUCTURE accepts only flat structures. Maybe I missed something :)

0

It´s the same difference as between TYPE and LIKE. INCLUDE STRUCTURE should refer to structured data objects only. But for reasons of backward compatiblity it can also refer to flat stuctures of the dictionary.

1

Thanks Horst. Now I better understand. I think that "[...] or the structure struc [...]" misleaded me, because of the word "structure" which I first understood as any structure, eventually a DDIC structure, and I felt the other sentence "Outside of ABAP objects, flat structures, database tables, or views in ABAP Dictionary [...]" was redundant, but I understand now it's not. I'd prefer the wording "or the structured data object struc" in the first sentence, but maybe other people would then not understand. And for database tables and views, there could be an addition "flat" for database tables and views.

0

I'll brush it up a bit ... (in 7.52).

1
Horst Keller
Jun 04, 2017 at 12:49 PM
0

Instead of

types:begin of t_zanshu2.

include structure zanshu2.

types: end of t_zanshu2.

Use

types t_zanshu2 type zanshu2.

Or directly

data: it_anshu type standard table of zanshu2 initial size 0,

...

Share
10 |10000 characters needed characters left characters exceeded