Skip to Content
0
Former Member
Apr 08, 2011 at 06:26 AM

How to put fields of two tables in one table that do not have a link

59 Views

Hi,

Below is my select query

SELECT otype
             objid
             plvar
             rsign
            relat
            begda
            endda
            sclas
            sobid FROM hrp1001 INTO CORRESPONDING FIELDS OF TABLE it_s2
           where otype = 'S' and plvar = '01'..
  
* Now I have to pass the variable in sobid to pernr, but both have different data type
* and length and also both the tables (hrp1001 and pa0002) do not have a common field
* so im passing the variable in sobid to pernr1 which is like pernr and then im making 
* seletion based on pernr1.      

loop at it_s2 into wa_s2.
  if wa_S2-SCLAS = 'P'.
    MOVE wa_s2-sobid to wa_s3-pernr1. 
    APPEND wa_s3 to it_s3.
    select pernr
           nachn
           vorna  FROM pa0002 into CORRESPONDING FIELDS OF TABLE it_s4
           where pernr = wa_s3-pernr1 .
 endif.
endloop.

Now my requirement is to put the above 12 fields into one internal table. How can that be achieved.