*&---------------------------------------------------------------------*
*& Report ZTR_DEMO_REPORT5 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZTR_DEMO_REPORT5 .
tables : yemp , ysal .
TYPES : BEGIN OF ST_JOIN ,
EMP_NO LIKE YEMP-EMP_NO ,
EMP_NAME LIKE YEMP-EMP_NAME,
SALARY LIKE YSAL-SALARY,
SALARY_UNIT LIKE YSAL-SALARY_UNIT,
END OF ST_JOIN .
DATA : WA_JOIN TYPE ST_JOIN .
DATA : IT_JOIN LIKE STANDARD TABLE OF WA_JOIN .
select e~EMP_NO
E~EMP_NAME
S~SALARY
S~SALARY_UNIT
FROM YEMP AS E INNER JOIN YSAL AS S
ON E~EMP_NO EQ S~EMP_NO
INTO TABLE IT_JOIN .
write :/5 'Inner JOIN' color 5 .
skip 3 .
LOOP AT IT_JOIN INTO WA_JOIN .
WRITE :/5 WA_JOIN-EMP_NO ,
20 WA_JOIN-EMP_NAME,
45 WA_JOIN-SALARY,
60 WA_JOIN-SALARY_UNIT.
ENDLOOP.
FREE : IT_JOIN .
skip 5 .
select e~EMP_NO
E~EMP_NAME
S~SALARY
S~SALARY_UNIT
FROM YEMP AS E LEFT OUTER JOIN YSAL AS S
ON E~EMP_NO EQ S~EMP_NO
INTO TABLE IT_JOIN .
BREAK-POINT.
write :/5 'Left OUTER JOIN' INVERSE color 5.
skip 2 .
LOOP AT IT_JOIN INTO WA_JOIN .
WRITE :/5 WA_JOIN-EMP_NO ,
20 WA_JOIN-EMP_NAME,
45 WA_JOIN-SALARY,
60 WA_JOIN-SALARY_UNIT.
ENDLOOP.
No comments:
Post a Comment