Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Coupling INNER JOIN with FOR ALL ENTRIES statement

Hi All,

I am coupling INNER JOIN with FOR ALL ENTRIES statement .....

Would you please highlight its implications ?? Is it a best practise ?

Is it advicable to use MULTIPLE INNER JOINs with a FOR ALL ENTRIES ???

SORT itab BY matnr.

IF NOT itab[] IS INITIAL.

SELECT epmatnr epebeln ep~ebelp

epwerks epmenge ep~netpr

ekps_psp_pnr ebbelnr eb~menge

INTO TABLE iekpo

FROM ekpo AS ep

INNER JOIN ekkn AS ek

ON ekebeln = epebeln

AND ekebelp = epebelp

INNER JOIN ekbe AS eb

ON ebebeln = epebeln

AND ebebelp = epebelp

AND eb~bwart = '101'

FOR ALL ENTRIES IN itab

WHERE ep~matnr = itab-matnr.

IF sy-subrc EQ 0.

SORT iekpo BY matnr werks.

LOOP AT itab ASSIGNING <itab>.

READ TABLE iekpo WITH KEY matnr = <itab>-matnr

werks = <itab>-werks

BINARY SEARCH.

IF sy-subrc EQ 0.

MOVE iekpo-matnr TO itab1-matnr.

MOVE iekpo-ebeln TO itab1-ebeln.

MOVE iekpo-ebelp TO itab1-ebelp.

MOVE iekpo-netpr TO itab1-poprice.

MOVE iekpo-werks TO itab1-werks.

MOVE iekpo-menge TO itab1-menge1.

MOVE iekpo-menge1 TO itab1-menge2.

MOVE iekpo-belnr TO itab1-belnr.

MOVE iekpo-ps_psp_pnr TO itab1-pspel.

MOVE <itab>-pspel TO itab1-tpspel.

MOVE <itab>-sobkz TO itab1-sobkz.

MOVE <itab>-fo_qty TO itab1-fo_qty.

MOVE <itab>-schgt TO itab1-schgt.

MOVE <itab>-postp TO itab1-postp.

MOVE <itab>-beskz TO itab1-beskz.

pend_qty = iekpo-menge1 - iekpo-menge2.

MOVE pend_qty TO itab1-pending.

APPEND itab1.

pend_qty = 0.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

Regards

Jaman

Edited by: ABAP Techie on Sep 15, 2008 12:39 PM

Edited by: ABAP Techie on Sep 15, 2008 12:41 PM

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question