2017 Feb 20 3:54 PM
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
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
2017 Feb 21 5:23 AM
any other approach will be fine for creating an internal table, please share if you know
2017 Jun 02 10:07 PM
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.
2017 Jun 04 1:57 PM
2017 Jun 04 2:48 PM
Thanks Horst. I couldn't find a clear explanation about the fact that INCLUDE STRUCTURE accepts only flat structures. Maybe I missed something 🙂
2017 Jun 05 1:35 PM
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.
2017 Jun 05 3:20 PM
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.
2017 Jun 06 8:53 PM
2017 Jun 04 1:49 PM
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,
...
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |