alternative to INCLUDE STRUCTURE in itab definition [solved]

Question: Hi Phillip.

What you've done here is defined a flat structure :-

data:
begin of i_table,
sub like itab2,
field2,
field3,
end of i_table.

If you want to define an internal table to which you can append data you'll need to add OCCURS 0 to the end of your "data: begin of i_table".

Yorkie
_________________
Nothing ever burns down by itself, every fire needs a little bit of help.

Answer:
Or alternatively do this:-

TYPES: BEGIN OF TY_STRUCTURE,
MATNR TYPE MATNR,
WERKS TYPE WERKS,
END OF TY_STRUCTURE.

DATA: T_MYTABLE TYPE STANDARD TABLE OF TYPE TY_STRUCTURE.
DATA: ST_MYSTRUCTURE TYPE TY_STRUCTURE.


This will give you an internal table and a seperate work area both of the structure defined by TY_STRUCUTRE. The keyword STANDARD is not needed but use the help to see other options. This is the preferred way with later versions of SAP (and has been the standard for my company for a long time) as ABAP Objects do not work with tables with header lines.

To use the table you can then:-
LOOP AT T_MYTABLE INTO ST_MYSTRUCTURE.
....
ENDLOOP.

APPEND ST_MYSTRUCTURE TO T_MYTABLE.

Hope this helps.

Answer:
thanks wizbongre,

5 minutes after I posted I saw the mistake.
And thanks for the other alternative too.

cheers,

Phillip
Copyright ?2007 - 2008 www.jt77.com