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

Need help in Coding

Former Member
0 Likes
713

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
665

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

2 REPLIES 2
Read only

Former Member
0 Likes
666

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

Read only

0 Likes
665

Thanks a lot Rob..