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

Display nested table in one grid

Former Member
0 Likes
694

Hi,

I have the following internal tables:


DATA: BEGIN OF itab_qual OCCURS 0,
        objid TYPE hrobjid,
        proficiency TYPE rating.
DATA: END OF itab_qual.

DATA: BEGIN OF itab_person OCCURS 0,
        pernr TYPE pernr_d,
        ename TYPE emnam,
        tasks LIKE itab_task OCCURS 0.
DATA: END OF itab_person.

So, I have a table with qualifications and this table is assigned to each person in the second table. Then the nested table itab_person-tasks is filled with the proficiency of each person for each qualification. I need to do it like this because the amount of qualifications can differ, and this way I have a dynamic solution.

What I would like to do next is display itab_person in a grid, including the proficiencies of each person for each qualification in the nested table.


PERNR	ENAME	QUAL1	QUAL2	QUAL3   
00001	name1	0002	0001 
00002	name2	0002	0001
00003	name3	0001	0001	0002

How can I do this? It shouldn't be hard, but I think I'm overlooking something, because I can't get it to work.

Anyone an idea?

Thanks! 🐵

Edited by: Dave Wolles on Aug 26, 2009 3:52 PM

2 REPLIES 2
Read only

Former Member
0 Likes
527

see its easy.

create a internal table with all the needed fields.

and loop at the tables you have data in.

pass each line to this final table.

and put this final table for ALV display..

Read only

Former Member
0 Likes
527

Hi Dave Wolles ,

Try this:

DATA: BEGIN OF itab_qual OCCURS 0,

pernr TYPE pernr_d, Add this field

objid TYPE hrobjid,

proficiency TYPE rating.

DATA: END OF itab_qual.

DATA: BEGIN OF itab_person OCCURS 0,

pernr TYPE pernr_d,

ename TYPE emnam,

tasks LIKE itab_task OCCURS 0.

DATA: END OF itab_person.

DATA: BEGIN OF itab_alv OCCURS 0,

pernr TYPE pernr_d,

ename TYPE emnam,

tasks LIKE itab_task OCCURS 0.

objid TYPE hrobjid,

proficiency TYPE rating.

DATA: END OF itab_alv.

LOOP AT itab_person.

READ TABLE itab_qual WITH KEY pernr = itab_person-pernr.

IF SY-SUBRC = 0.

MOVE-CORRESPONDIG itab_person TO itab_alv.

MOVE-CORRESPONDIG itab_qual TO itab_alv.

APPEND itab_alv.

ENDIF.

ENDLOOP.

Use the internal table itab_alv in ALV display.

Hope this information is help to you.

Regards,

José