Application Development 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: 

joins on for all entries

Former Member
0 Kudos

Hi all,

Can we use the "INNER JOIN" ,when we put the "for all entries" in selection statement?

Thanks,

jyothi D.

6 REPLIES 6

varma_narayana
Active Contributor
0 Kudos

Hi..

Yes we can use..

But it may Slow down the Performance.

<b>Reward if Helpful.</b>

Former Member
0 Kudos

Hi Jyothi,

They are two ways of joining the tables, you can use any method.

But performance point of view FOR ALL ENTRIES is better than INNER JOIN.

<b>Reward for helpful answers</b>

Satish

Former Member
0 Kudos

Hi,

Yes, we can use INNER JOIN when we put FOR ALL ENTRIES in one selection staement.

Example is as follows:

TABLES: MARA , MAKT.

TYPES: BEGIN OF GS_DATA,

MATNR TYPE MARA-MATNR,

END OF GS_DATA,

BEGIN OF GS_DATA1,

MATNR TYPE MARA-MATNR,

MAKTX TYPE MAKT-MAKTX,

WERKS TYPE MAKG-WERKS,

END OF GS_DATA1.

DATA: ITAB1 TYPE STANDARD TABLE OF GS_DATA,

WA1 LIKE LINE OF ITAB1,

ITAB2 TYPE STANDARD TABLE OF GS_DATA,

WA2 LIKE LINE OF ITAB2.

START-OF-SELECTION.

SELECT MATNR INTO CORRESPONDING FIELDS OF TABLE ITAB1 FROM MARA.

SELECT AMATNR AMAKTX B~WERKS

FROM ( MAKT AS A INNER JOIN MAKG AS B

ON AMATNR = BMATNR )

INTO CORRESPONDING FIELDS OF TABLE ITAB2

FOR ALL ENTRIES IN ITAB1

WHERE A~MATNR = ITAB1-MATNR.

Reward if useful.

Regards,

Shilpi

Former Member
0 Kudos

Hi jyothi,

1. Yes, we can put.

2. Inner Join, and For all entries do not have any connection.

3. Inner join = used for connecting two database tables

For all entries = to Filter Out the selection,

based upon some values in our internal table.

regards,

amit m.

Former Member
0 Kudos

Hi Jyothi,

Yes. You can use For All entries when using Inner joins.

But in performance perspective, using Inner joins gives less performance .

Reward if Useful.

Regards,

Chitra

Former Member
0 Kudos

yes...

see sample programs

IF GT_IMAK[] IS NOT INITIAL.

SELECT A~POSNR

A~OBJNR

B~PRNAM

B~POSID

B~GJAHR

FROM IMZO AS A

INNER JOIN IMPR AS B ON

APOSNR = BPOSNR

INTO CORRESPONDING FIELDS OF TABLE GT_INVT

FOR ALL ENTRIES IN GT_IMAK

WHERE A~OBJNR = GT_IMAK-OBJNR1.

ENDIF.

IF IT_EKPO[] IS NOT INITIAL.

select MARAMATNR MARAMTART MAKT~MAKTX

FROM MARA

INNER JOIN MAKT

ON MARAMATNR = MAKTMATNR

INTO TABLE IT_MAT

FOR ALL ENTRIES IN IT_EKPO

WHERE MARA~MATNR = IT_EKPO-MATNR.

ENDIF.

If not it_lfb1[] is initial.

SELECT lfa1lifnr lfa1land1

lfa1~name1

lfa1~ort01

lfa1~regio

lfm1~ekorg

FROM lfa1 INNER JOIN lfm1

ON lfa1lifnr = lfm1lifnr

for all entries in it_lfb1

where lifnr = it_lfb1-lifnr.

ENDIF.