‎2016 Mar 16 4:42 PM
Hello Experts,
I am new to ABAP development. I know this must be very simple to you but as a new to development i having problem linking two internal table to my final table.
I am trying to fetch few fields from couple of tables(but000 and adrp) and then trying to display it in my final internal table.
TYPES: BEGIN OF ty_but000,
partner TYPE but000-partner,
type TYPE but000-type,
persnumber TYPE but000-persnumber,
partner_guid TYPE but000-partner_guid,
END OF ty_but000.
DATA: it_but000 TYPE STANDARD TABLE OF ty_but000,
wa_but000 TYPE ty_but000.
TYPES: BEGIN OF ty_adrp,
persnumber TYPE adrp-persnumber,
addr_comp TYPE adrp-addr_comp,
END OF ty_adrp.
DATA: it_adrp TYPE STANDARD TABLE OF ty_adrp,
wa_adrp TYPE ty_adrp.
TYPES: BEGIN OF ty_final,
partner TYPE but000-partner,
type TYPE but000-type,
persnumber TYPE but000-persnumber,
partner_guid TYPE but000-partner_guid,
addr_comp TYPE adrp-addr_comp,
END OF ty_final.
DATA: it_final TYPE STANDARD TABLE OF ty_final,
wa_final TYPE ty_final.
SELECT partner
type
persnumber
partner_guid
from but000
INTO TABLE it_but000
WHERE type = 1..
IF it_but000 is not INITIAL .
SELECT persnumber
addr_comp
from adrp
INTO TABLE it_adrp
FOR ALL ENTRIES IN it_but000
WHERE persnumber = it_but000-persnumber.
ENDIF.
Now I am trying to fetch the field in my final internal table (IT_Table), I know the inner join method, wanted to do with for all entries.
I know this is very simple tried googling it but couldn't find the specific way.
Your help will be highly appreciated.
Regards,
Sarnava.
‎2016 Mar 16 5:18 PM
A JOIN would be more efficient, because you won't have to do the following:
LOOP AT IT_BUT000
move the fields you want to keep to wa_final
Read all entries in table IT_ADRP for the personnel number in IT_BUT000
APPEND WA_FINAL to IT_FINAL for each record found in IT_ADRP
Rob
‎2016 Mar 16 5:18 PM
A JOIN would be more efficient, because you won't have to do the following:
LOOP AT IT_BUT000
move the fields you want to keep to wa_final
Read all entries in table IT_ADRP for the personnel number in IT_BUT000
APPEND WA_FINAL to IT_FINAL for each record found in IT_ADRP
Rob
‎2016 Mar 16 5:59 PM