ABAP/SAP thinks my Z transparent table is a flat structure

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
FrankMVenlo
Posts: 2
Joined: Wed Aug 31, 2011 12:47 am

ABAP/SAP thinks my Z transparent table is a flat structure

Post by FrankMVenlo » Wed Nov 06, 2013 4:12 am

Hi,

I have a big problem.

I made a Ztable and this table is reachable via SE16 ( although empty ) and i want to fill it in a ABAP program.
But when i click on the Ztable in debug modus , it says Flat Structure.
I can use my table as a work area and can use the Update and Insert command without getting syntax errors but the program refuses to fill the table it simply dont do anything when i pass the code ( Update for example )

Both tables in the code are transparent tables with the A property ( applicationtable )

What is wrong?

TABLES: ZTUSSENTABELZIEK,
ZTUSTABELZIEK.

*FM 18-10-2013 Loopje toevoegen om de ziektecategorieen ook toe te voegen.
LOOP AT it_detail INTO wa_detail.
MOVE-CORRESPONDING wa_detail TO wa_ztussen.
wa_ztussen-mandt = SY-MANDT.
MOVE-CORRESPONDING wa_ztussen TO ZTUSTABELZIEK.
UPDATE ZTUSSENTABELZIEK FROM wa_ztussen.
ENDLOOP.

VLozano
Posts: 5142
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity
Contact:

Re: ABAP/SAP thinks my Z transparent table is a flat structure

Post by VLozano » Wed Nov 06, 2013 8:20 am

The wrong thing is SAP still allows people to use the TABLES sentence.

When you use it, you are defining a variable with: an internal table with an associated header line, using the same name than the table to "clone".

For the sample you've provided, I should advice you to use an UPDATE sentence (remember: use UPDATE only with YOUR Z tables, never with SAP ones).
Tuly Idiots
Because we know we are part of the problem

Grogan
Posts: 365
Joined: Thu Aug 04, 2005 7:16 pm
Location: Australia

Re: ABAP/SAP thinks my Z transparent table is a flat structure

Post by Grogan » Wed Nov 06, 2013 3:32 pm

1) The TABLES statement does not define an internal table, it defines a work area identical to the named dictionary structure. The TABLES statement is deprecated and should no longer be used. Your code uses its own work area WA_ZTUSSEN anyway so you can get rid of the TABLES statement altogether.

2) The UPDATE statement only updates existing records on the database. If you want to add new records use INSERT or MODIFY.
Grogan

Award cash if useful.

Rich
Posts: 7116
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool
Contact:

Re: ABAP/SAP thinks my Z transparent table is a flat structure

Post by Rich » Thu Nov 07, 2013 10:20 am

VLozano wrote:The wrong thing is SAP still allows people to use the TABLES sentence.

When you use it, you are defining a variable with: an internal table with an associated header line, using the same name than the table to "clone".

For the sample you've provided, I should advice you to use an UPDATE sentence (remember: use UPDATE only with YOUR Z tables, never with SAP ones).
Hummm...

I QA'd some code only a month or two ago and the guy was still using things like

Code: Select all

TABLES: KNA1, *KNA1
Needless to sy it was sent back for re-work.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com

Post Reply