Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem with inner join!!!!

Former Member
0 Likes
1,210

i used inner join for joining 4 tables in my program. but i m not sure that the select statement is correct. but its showing syntactically correct in my program.

the problem is im not getting the output.

could any body help me in my code

REPORT Z_DELIVERY_DETAILS.

TABLES : QMFE, QMSM, MAKT, VBAP, EKPO, EKET.

SELECT-OPTIONS : PLANT FOR VBAP-WERKS,

CODGRUP FOR QMFE-OTGRP,

MATERIAL FOR MAKT-MATNR.

DATA : BEGIN OF ITAB OCCURS 0,

MNCOD LIKE QMSM-MNCOD,

OTGRP LIKE QMFE-OTGRP,

BAUGRUPPE LIKE QMFE-BAUTL,

MATEXT LIKE MAKT-MAKTX,

SALESORDR LIKE VBAP-VBELN,

SALESPOS LIKE VBAP-POSNR,

PURORDER LIKE EKET-EBELN,

PURPOS LIKE EKET-EBELP,

SHDQTY LIKE EKET-MENGE,

QTYREC LIKE EKET-WEMNG,

EINDT LIKE EKET-EINDT,

END OF ITAB.

DATA : STAB LIKE TABLE OF ITAB.

DATA : CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

GRID TYPE REF TO CL_GUI_ALV_GRID,

gt_fieldcat TYPE lvc_t_fcat.

SELECT AOTGRP ABAUTL BMAKTX CVBELN CPOSNR EEBELN EEBELP EMENGE EWEMNG EEINDT

INTO CORRESPONDING FIELDS OF TABLE STAB FROM

( QMSM AS F INNER JOIN QMFE AS A ON FQMNUM = AQMNUM

INNER JOIN MAKT AS B ON AMATNR = BMATNR

INNER JOIN VBAP AS C ON BMATNR = CMATNR

INNER JOIN EKPO AS D ON BMATNR = DMATNR

INNER JOIN EKET AS E ON DEBELN = EEBELN )

WHERE C~WERKS IN PLANT

AND A~OTGRP IN CODGRUP

AND F~MNCOD = '3050'.

CALL SCREEN 0001.

5 REPLIES 5
Read only

Former Member
0 Likes
679

Hi,

Try to debug the code and check, you will know whether data is coming or not.

Paste your code here.

Thanks,

Anitha

Read only

Former Member
Read only

Former Member
0 Likes
679

Hi,

hope there is no data present in db for Criteria u r giving.

Jogdand M B

Read only

0 Likes
679

Hi abhilash venkata,

Try to debug your "select" by commenting a "join line" then test it.

perform a step by step debug like this.

Hope this helps,

Erwan

Read only

0 Likes
679

hi erwan,

i have divided this program and made the first two tables seperately and the rest of ther tables seperately as different programs. then iam able to get the results, but when i gave everything in one program im not getting .

my seperate codes :

first two tables are joined as follows:

SELECT TMNGRP SBAUTL INTO CORRESPONDING FIELDS OF TABLE ITAB1

FROM QMSM AS T LEFT OUTER JOIN QMFE AS S ON SQMNUM = TQMNUM

WHERE ( T~MNCOD EQ '3050'

AND T~MNCOD NE '3100' )

AND T~MNGRP IN CODGROUP.

CALL SCREEN 0001.

rest of the tables joined as follows :

SELECT AMAKTX BVBELN BPOSNR CEBELN CEBELP CMENGE CWEMNG CEINDT

INTO CORRESPONDING FIELDS OF TABLE STAB FROM

( MAKT AS A INNER JOIN VBAP AS B ON AMATNR = BMATNR

INNER JOIN EKPO AS D ON AMATNR = DMATNR

INNER JOIN EKET AS C ON DEBELN = CEBELN )

WHERE B~WERKS IN PLANT

AND B~MATNR IN MATERIAL

AND A~SPRAS = 'D'.

CALL SCREEN 0001.

the above two codes were given in two different programs. then i got the result

but when i gave together as follows:

SELECT

A~OTGRP

A~BAUTL

B~MAKTX

C~VBELN

C~POSNR

E~EBELN

E~EBELP

E~MENGE

E~WEMNG

E~EINDT

INTO CORRESPONDING FIELDS OF TABLE STAB FROM

( QMSM AS F INNER JOIN QMFE AS A ON AQMNUM = FQMNUM

LEFT OUTER JOIN MAKT AS B ON AMATNR = BMATNR

INNER JOIN VBAP AS C ON BMATNR = CMATNR

INNER JOIN EKPO AS D ON BMATNR = DMATNR

INNER JOIN EKET AS E ON DEBELN = EEBELN )

WHERE C~WERKS IN PLANT

AND C~MATNR IN MATERIAL

  • AND B~SPRAS = 'D'

AND A~OTGRP IN CODGRUP

AND F~MNCOD = '3050'.

CALL SCREEN 0001.

so could anybody help me in this aspect????????