Skip to Content

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

Outer Join (select) statement

hI

Im BW-Consultant. I have two tables with some fileds.

ZTABLE1 ---> MATNR, PRCTR, BUKRS, LIGNG, MATGR.And this table has 5-materials

ZTABLE2 --> MATNR, PRCTR, BUKRS, FKMNG, VERID. And this table has 10-materials.

These two tables(ZTABLE1, ZTABLE2) has 3-materials are common.

But i want all 15-materials in an another table ZTABLE3. So how can i write an <b>outer join statement.</b> .

Please give the OuterJoinCode(select statement) to get all 15-materials

regards

kumar

Tags:
Former Member
Former Member replied

Example

SELECT KNA1~KUNNR KNA1~ADRNR ADR6~SMTP_ADDR 
INTO (A, B, C) 
FROM KNA1 LEFT OUTER JOIN ADR6 
ON KNA1~ADRNR = ADR6~ADDRNUMBER 
WHERE KUNNR BETWEEN '0000000000' AND '0000500000'.

*-----------------------------------

DATA: BEGIN OF wa,
        carrid   TYPE scarr-carrid,
        carrname TYPE scarr-carrname,
        connid   TYPE spfli-connid,
      END OF wa,
      itab LIKE SORTED TABLE OF wa
                WITH NON-UNIQUE KEY carrid.

SELECT s~carrid s~carrname p~connid
  INTO CORRESPONDING FIELDS OF TABLE itab
  FROM scarr AS s
       LEFT OUTER JOIN spfli AS p ON s~carrid   =  p~carrid AND
                                     p~cityfrom = 'FRANKFURT'.

LOOP AT itab INTO wa.
  WRITE: / wa-carrid, wa-carrname, wa-connid.
ENDLOOP.



A

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question