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 IN SELECT QUERY.......

Former Member
0 Likes
619

PROBLEM IN SELECT QUERY.......


SELECT  MATNR BANFN BNFPO MATKL ERNAM AFNAM BADAT MENGE

     FROM EBAN INTO CORRESPONDING FIELDS OF TABLE IT_EBAN

     FOR ALL ENTRIES IN IT_MARA

     WHERE MATNR = IT_MARA-MATNR

     AND WERKS IN SO_PLANT

     AND STATU = 'N'   " PO, SA not released, N--edit

     AND LOEKZ <> 'X'  " Not deleted

     AND FRGZU <> ' '. " Not released

not fetching all records from EBAN corresponding to  MARA TABLE

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
594

Hi,

Please check is there duplicate entries in EBAN table because 'For all entries' clause delete the duplicate entries.

Regards

Ajay Goel

3 REPLIES 3
Read only

Former Member
0 Likes
595

Hi,

Please check is there duplicate entries in EBAN table because 'For all entries' clause delete the duplicate entries.

Regards

Ajay Goel

Read only

0 Likes
594

BUT

SELECT  *

     FROM EBAN INTO CORRESPONDING FIELDS OF TABLE IT_EBAN

     FOR ALL ENTRIES IN IT_MARA

     WHERE MATNR = IT_MARA-MATNR

     AND WERKS IN SO_PLANT

     AND STATU = 'N'   " PO, SA not released, N--edit

     AND LOEKZ <> 'X'  " Not deleted

     AND FRGZU <> ' '. " Not released

fetching all records  and we needs all records also duplicate. so i am confuse why

this query not working

SELECT  MATNR BANFN BNFPO MATKL ERNAM AFNAM BADAT MENGE

     FROM EBAN INTO CORRESPONDING FIELDS OF TABLE IT_EBAN

     FOR ALL ENTRIES IN IT_MARA

     WHERE MATNR = IT_MARA-MATNR

     AND WERKS IN SO_PLANT

     AND STATU = 'N'   " PO, SA not released, N--edit

     AND LOEKZ <> 'X'  " Not deleted

     AND FRGZU <> ' '. " Not released



Read only

0 Likes
594

Hi,

Because if you are selecting with * then all the fields are fetching and all the values can not be same for all fields but if you are taking only selected fields then values of all theses fields are same then it will drop all duplicate records. So use one columns which should be different in all records.

Regards

Ajay