Give the syntax of Inner,outer Join?"

Answer Posted / shreeshail diggi

Effect
The join syntax represents a recursively nestable join
expression. A join expression consists of a left-hand and a
right- hand side, which are joined either by means of
[INNER] JOIN or LEFT [OUTER] JOIN. Depending on the type of
join, a join expression can be either an inner (INNER) or
an outer (LEFT OUTER) join. Every join expression can be
enclosed in round brackets. If a join expression is used,
the SELECT command circumvents SAP buffering.

The syntax of the join conditions join_cond is the same as
that of the sql_cond conditions after the addition WHERE,
with the following differences:

At least one comparison must be specified after ON.

Individual comparisons may be joined using AND only.

All comparisons must contain a column in the database table
or the view dbtab_right on the right-hand side as an
operand.

The following additions not be used: NOT, LIKE, IN.

No sub-queries may be used.

For outer joins, only equality comparisons (=, EQ) are
possible.

If an outer join occurs after FROM, the join condition of
every join expression must contain at least one comparison
between columns on the left-hand and the right-hand side.

In outer joins, all comparisons that contain columns as
operands in the database table or the view dbtab_right on
the right-hand side must be specified in the corresponding
join condition. In the WHERE condition of the same SELECT
command, these columns are not allowed as operands

Example INNER JOIN :

Join the columns carrname, connid, fldate of the database
tables scarr, spfli and sflight by means of two inner
joins. A list is created of the flights from p_cityfr to
p_cityto. Alternative names are used for every table.

PARAMETERS: p_cityfr TYPE spfli-cityfrom,
p_cityto TYPE spfli-cityto.

DATA: BEGIN OF wa,
fldate TYPE sflight-fldate,
carrname TYPE scarr-carrname,
connid TYPE spfli-connid,
END OF wa.

DATA itab LIKE SORTED TABLE OF wa
WITH UNIQUE KEY fldate carrname connid.

SELECT c~carrname p~connid f~fldate
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( scarr AS c
INNER JOIN spfli AS p ON p~carrid = c~carrid
AND p~cityfrom = p_cityfr
AND p~cityto = p_cityto )
INNER JOIN sflight AS f ON f~carrid = p~carrid
AND f~connid = p~connid ).

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

Example OUTER JOIN:

PARAMETERS p_cityfr TYPE spfli-cityfrom.

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 =
p_cityfr.

LOOP AT itab INTO wa.
IF wa-connid = '0000'.
WRITE: / wa-carrid, wa-carrname.
ENDIF.
ENDLOOP.

Thank's and Regards,
Shreeshail Diggi
SAP Technical Consultant Infinite India

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of records that are transferred to sap r/3 and used by interfaces? : abap bdc

542


Why bapi need then bdc ? : abap bdc

582


Static and instance variable and method with live example. Why and when to use

933


How would you suppress the display of a parameter on the selection screen?

567


What is a modification assistant?

591






Explain the disadvantages of different types of bdc's?

518


Explain the advantages of abap query tool?

530


What are screen painter and menu painter? : abap hr

575


can anybody give me functional specification (or table name & field names) of stock analysis report, work in progress report,generating vendor detailed list

1515


Different types of luws. What are they?

622


1.why dont use top of page. wat is the use? 2. wat is sub screen? 3. why u select the session method in bdc ? how many records wil be updated on that time? 4.why dont use start form in script? 5.wat is difference b/w dilldown and interactive report? 6. wat is pf status interactine report?

2356


How to create any functions? How to go about it?

585


What is interactive reporting?

618


What are the 2 other types of views, which are not allowed in release 3.0?

628


In Smartforms or ADOBE Forms Can we get text from standard table in verticle form? if yes, How?

1815