Application Development and Automation 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 only

Table problem on SE37

Former Member
0 Likes
727

I created a ZTABLE ZTABANOMALIST, and filled it.

I'm creating a fonction to display it (with some enhancements). On the Tab "Table" I declared

ZTEMPTAB LIKE ZTABANOMALIST.

My aim is to write a SQL SELECT like

SELECT * from ZTABANOMALIST into ....

Before to write this code (and actually after) when I check my code a have this error message.

<i>"ZTABANOMALIST" must be a flat structure. You cannot use internal </i>

Does somebody know why ?

Thanks a lot

J

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
631

Hi Jerome,

You should not declare under the TABLE tab.

declare it as below.

<b>

DATA: ZTEMPTAB LIKE ZTABANOMALIST OCCURS 0 WITH HEADER LINE.</b>

4 REPLIES 4
Read only

Former Member
0 Likes
632

Hi Jerome,

You should not declare under the TABLE tab.

declare it as below.

<b>

DATA: ZTEMPTAB LIKE ZTABANOMALIST OCCURS 0 WITH HEADER LINE.</b>

Read only

Former Member
0 Likes
631

Hello Jerome,

By putting the ZTEMPTAB on the table-tab you declared the ZTEMPTAB as a table-type, not as a structure (or in older terms a "header-line"). So either create a flat structure with a statement like

data: ZTEMPSTRUC like line of ZTEMPTAB.

Now you can select directly into this ZTEMPSTRUC for further processing, or appending to table ZTEMPTAB.

Another way of doing it (depending on what you need to do) is by filling the internal table immediately using the following code

 SELECT * from ZTABANOMALIST into table ZTEMPTAB.

If you follow Phani's suggestions, you won't be able to import / export values to/from the function module.

I hope this helps. Good luck!

Jan-Willem Kaagman

Message was edited by: J.W.F. Kaagman

Read only

Former Member
0 Likes
631

declare another table

data : ZTEMP LIKE ZTABANOMALIST occurs 10 with header line.

select * from ZTABANOMALIST into ZTEMP.

ztemptab[] = ztemp[].

Read only

0 Likes
631

Just to add a little, the OCCURS statement is obselete in new versions and can not be used in ABAP objects. It is suggest that you start moving away from using the OCCURS statement when defining an internal table. You should be using TYPE TABLE OF instead.

DATA: ZTEMPTAB type table of ZTABANOMALIST WITH HEADER LINE.

Also the "WITH HEADER LINE" is obselete and not allowed in ABAP objects, you should be defining a seperate work area for this.



DATA: ZTEMPTAB Type table of ZTABANOMALIST.
data: wa_temptab like line of ztemptab.

REgards,

Rich Heilman