cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Internal table from Multiple tables

Former Member
0 Kudos

Hi ,

I,m trying to create an internal table from 5 databse tables namely

PA0001-PERNR, PA0002-NACHN, VORNA, PA0009-BANKN, PA0002-PERID, PA0000-STAT2, PA0006-STRAS,PSTLZ,LAND1 (when the PA0006-SUBTY is 1)

Condition for this is that this internal table should contain all the records that are present in the PPOIX table for which I wrote the following code

SELECT * FROM PPOIX

INTO wa_ppoix.

APPEND wa_ppoix TO it_ppoix.

ENDSELECT.

DELETE ADJACENT DUPLICATES FROM it_ppoix comparing PERNR.

Now I want to build a internal table for all the unique values fetched in it_ppoix

my structure looks as below

BEGIN OF rere_KuLe,

reId type PA0001-PERNR,

reTy(1) type c,

reNav1 type PA0002-NACHN,

reNav2 type PA0002-VORNA,

bnkAcNo type PA0009-BANKN,

enhNr type PA0002-PERID,

status type PA0000-STAT2,

crCn(20) type c,

add1 type PA0006-STRAS,

add2 type PA0006-PSTLZ,

add3 type PA0006-LAND1,

date(8) type c,

date1(8) type c,

END OF rere_KuLe.

can someone please help on the same or give me an general approach on achieving the same.

Thanks for your help in advance.

Thanks,

Advait.

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You will need to loop at your IT_PPOIX and do some select statements against each table.

Here is an example of selecting against one of your tables, PA0002.

LOOP at IT_PPOIX.

select Single nachn vorna into corresponding fields of iT_PPOIX
         from pa0002 
                where pernr = IT_PPOIX-pernr.

modify IT_PPOIX.

ENDLOOP.

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

ok, then all you need to do is move the fields to the new internal table and this time APPEND it.



data: xpa0002 type pa0002.
LOOP at IT_PPOIX.

select Single nachn vorna
    into corresponding fields of xpa0002   
        from pa0002                
         where pernr = IT_PPOIX-pernr.

move-corresponding xpa0002 to new_itab.
append new_itab.


ENDLOOP.


Regards,

Rich Heilman

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks, that solved my problem, I'm trying to reward points but says error

Former Member
0 Kudos

But the final Itab I want to populate is rere_KuLe and not it_ppoix. Any suggesstions

Thanks

Advait.