Skip to Content
0
Former Member
Dec 19, 2006 at 09:31 AM

PROB INNER JOIN

67 Views

BELOW IS MY PROGRAM. AND I WANT TO SHOW THE WHOLE DATA OF ALL THE TABLE.SO HOW I WILL DEFINE TABLE IN DATA STATEMENT AND IN SELECT STATEMENT.

PLZ IT'S URGENT

TAHNKS..

SAM

&----


*& Report ZTEMP_JOIN

*&

&----


*&

*&

&----


REPORT ZTEMP_JOIN.

TABLES: MARA,MARC,MARD,MSEG, MAST.

SELECT-OPTIONS: SAM FOR MARA-MATNR.

DATA: BEGIN OF ITAB OCCURS 0,

MATNR LIKE MARA-MATNR,

ERSDA LIKE MARA-ERSDA,

ERNAM LIKE MARA-ERNAM,

MTART LIKE MARA-MTART,

WERKS LIKE MARC-WERKS,

PSTAT LIKE MARC-PSTAT,

LVORM LIKE MARC-LVORM,

LFGJA LIKE MARD-LFGJA,

MBLNR LIKE MSEG-MBLNR,

MJAHR LIKE MSEG-MJAHR,

BWART LIKE MSEG-BWART,

STLAN LIKE MAST-STLAN,

STLAL LIKE MAST-STLAL,

STLNR LIKE MAST-STLNR,

END OF ITAB.

SELECT MA~MATNR MA~ERSDA MA~ERNAM MA~MTART MC~WERKS MC~PSTAT MC~LVORM MD~LFGJA MG~MBLNR MG~MJAHR MG~BWART MT~STLAN MT~STLAL MT~STLNR

INTO TABLE ITAB FROM MARA AS MA INNER JOIN MARC AS MC ON

MA~MATNR = MC~MATNR

INNER JOIN MARD AS MD ON

MC~MATNR = MD~MATNR

INNER JOIN MSEG AS MG ON

MD~MATNR = MG~MATNR

INNER JOIN MAST AS MT ON

MG~MATNR = MT~MATNR

WHERE MA~MATNR IN SAM.

LOOP AT ITAB.

WRITE:/ ITAB-MATNR,ITAB-ERSDA,ITAB-ERNAM,ITAB-MTART,ITAB-WERKS, ITAB-PSTAT, ITAB-LVORM, ITAB-LFGJA,

ITAB-MBLNR, ITAB-MJAHR, ITAB-BWART, ITAB-STLAN, ITAB-STLAL, ITAB-STLNR.

ENDLOOP.

*

*START-OF-SELECTION.

  • WRITE: / 'line 1'.

  • WRITE: / 'line 2'.

  • WRITE: / 'line 3'.

TOP-OF-PAGE.

WRITE: / 'MM FIVE TABLES INNNER JOIN'.

ULINE.

TOP-OF-PAGE.

WRITE: /1(109) sy-uline.

WRITE: /1 '|', 2(18) 'MATNR-MATNR' COLOR 1,

20 '|', 21(8) 'ERSDA' COLOR 2,

29 '|', 30(12) 'ERNAM-ERNAM' COLOR 3,

42 '|', 43(4) 'MTART' COLOR 4,

47 '|', 48(4) 'WERKS' COLOR 5,

52 '|', 53(15) 'PSTAT-PSTAT' COLOR 6,

68 '|', 69(1) 'LVORM' COLOR 7,

70 '|', 71(4) 'LFGJA' COLOR 1,

75 '|', 76(10) 'MBLNR' COLOR 2,

86 '|', 87(4) 'MJAHR' COLOR 3,

91 '|', 92(3) 'BWART' COLOR 4,

95 '|', 96(1) 'STLAN' COLOR 5,

97 '|', 98(2) 'STLAL' COLOR 6,

100 '|', 101(8) 'STLNR' COLOR 7,

109 '|'.

WRITE: /1(109) sy-uline.