Skip to Content
author's profile photo Former Member
Former Member

Creating Internal table from Multiple tables

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Oct 19, 2005 at 03:37 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 01:38 PM

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

    Thanks

    Advait.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 03:28 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.