Skip to Content
0
Former Member
Oct 23, 2006 at 12:47 PM

Nested structures within ABAP

1328 Views

Hello,

I am working on an ABAP report where the output file will need to look something like:-

1 Material No, Description

2 EAN, ...

3 ..., ..., ...

3 ..., ..., ...

4 ..., ..., ...

4 ..., ...

Some of the record types will only have one line and others will have multiple.

I was hoping to create an internal table into which I could extract all of the relevant data.

To do this, I was thinking of setting up my internal table as a nested structure so I would define some types for each record type

e.g.

types: begin of rec_type_1

matnr like mara-matnr

...

...

end of rec_type_1

types: begin of rec_type_2

...

...

...

end of rec_type_2

and then I could declare my internal table something like:-

data: begin of itab

rec1 type rec_type_1

rec2 type rec_type_2

...

end of itab

I could then extract the relevant information for each material into the appropriate record types.

This will work OK for all the record types where this is only going to be 1 line per material but I am not sure how to extend this for the record structures for which there will be multiple lines per material.

I was thinking of declaring a table and then adding this as an element into the itan structure.

Will this work? And does anyone have any code samples of this sort of thing?

Thanks,

Ruby