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: 

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

Former Member
0 Kudos

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

8 REPLIES 8

Former Member
0 Kudos

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

Sandra_Rossi
Active Contributor
0 Kudos

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.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Sandra, what is unclear to you?

0 Kudos

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

horst_keller
Product and Topic Expert
Product and Topic Expert

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.

0 Kudos

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.

horst_keller
Product and Topic Expert
Product and Topic Expert

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

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

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,

...