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

join the 2 selected tables

Former Member
0 Likes
603

Hi,

In my senario, i get the data from 2 different table and kept in 2 internal tables and did the some calculations on those. later i want to club that 2 internal tables and keep as 1 internal table, for that which statement is applicable.

Thanks

5 REPLIES 5
Read only

Former Member
0 Likes
566

Hi,

Which are the two tables from which you are getting the data. Try using inner joins if those two tables have any common key.

Then pass this data to one internal table.

Regards,

Raj

Read only

Former Member
0 Likes
566

hi

Based on the Primary key ,You can loop the internal table and append into final table.

Using read statement u can calli the another internal table.

Read only

Former Member
0 Likes
566

HI,

You can use either INNER JOIN or FOR ALL ENTRIES Technique.

Regards:

ManojReddy

Read only

Former Member
0 Likes
566

hi ,

Performance wise FOR ALL ENTRIES is better .If possible try to use FOR ALL ENTRIES instead of join.

regards

Gaurav

Read only

Former Member
0 Likes
566

Hi

You can check this code for reference. Iam transfering data from different internal tables to one final internal table i.e. it_disp1

LOOP AT IT_EKKO INTO WA_EKKO.
    WA_DISP1-EBELN = WA_EKKO-EBELN.
    WA_DISP1-BUKRS = WA_EKKO-BUKRS.
    WA_DISP1-BSTYP = WA_EKKO-BSTYP.
    WA_DISP1-BSART = WA_EKKO-BSART.
    WA_DISP1-LIFNR = WA_EKKO-LIFNR.
    WA_DISP1-WERKS = WA_EKKO-WERKS.
    WA_DISP1-EKGRP = WA_EKKO-EKGRP.
    WA_DISP1-KUNNR = WA_EKKO-KUNNR.
    READ TABLE IT_T001 INTO WA_T001 WITH KEY BUKRS = WA_EKKO-BUKRS
                                                     BINARY SEARCH.
    IF SY-SUBRC = 0.
      WA_DISP1-BUTXT = WA_T001-BUTXT.
    ENDIF.
    READ TABLE IT_LFA1 INTO WA_LFA1 WITH KEY LIFNR = WA_EKKO-LIFNR
                                                     BINARY SEARCH.
    IF SY-SUBRC = 0.
      WA_DISP1-NAME1V = WA_LFA1-NAME1V.
      CONCATENATE WA_DISP1-NAME1V WA_LFA1-NAME2V INTO WA_DISP1-NAME1V SEPARATED BY SPACE.
    ENDIF.
    READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_EKKO-KUNNR
                                                     BINARY SEARCH.
    IF SY-SUBRC = 0.
      WA_DISP1-NAME1C = WA_KNA1-NAME1C.
      CONCATENATE WA_DISP1-NAME1C WA_KNA1-NAME2C INTO WA_DISP1-NAME1C SEPARATED BY SPACE.
    ENDIF.
    READ TABLE IT_T001W INTO WA_T001W WITH KEY WERKS = WA_EKKO-WERKS
                                                    BINARY SEARCH.
    IF SY-SUBRC = 0.
      WA_DISP1-NAME1P = WA_T001W-NAME1P.
    ENDIF.
    APPEND WA_DISP1 TO IT_DISP1.
    CLEAR: WA_EKKO, WA_DISP1, WA_T001, WA_LFA1, WA_T001W, WA_KNA1, WA_EKPO.
  ENDLOOP.

Regards

Anshul