Skip to Content
-2

For all entries not working in negative where clause

Aug 13, 2017 at 03:54 PM

88

avatar image
Former Member

Hi,

in this below code where clause is not working PRUEFLOS <> it_qals-PRUEFLOS.

i am getting all the entries which is in qals data base records also.please do needful.

types : begin of ty_qave,
PRUEFLOS type QPLOS,
KZART type QKZART,
ZAEHLER type QVEZAEHLER,
VWERKS type werks_d,
VCODE type QVCODE,
end of ty_qave.

data : it_qave type standard table of qave,
wa_qave type ty_qave.

types : begin of ty_qals,
PRUEFLOS type QPLOS,
WERK type werks_d,
end of ty_qals.

data : it_qals type standard table of qals,
wa_qals type ty_qals.

elect PRUEFLOS werk from qals into table it_qals where werk = '17825'.

select PRUEFLOS KZART KZART ZAEHLERV WERKS VCODE from qave into table it_qave for all entries in it_qals where PRUEFLOS <> it_qals-PRUEFLOS.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Mike Pokraka Aug 13, 2017 at 04:46 PM
2

Works as expected. The 'needful':

https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenwhere_logexp_itab.htm

In future please post code using code formatting. More people might read it.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

okay sure..next time i will use code format.i am not getting not equal entries in QALS and QAVE on above select query..please guide me if i was wrong...

0

Using a JOIN should always be your first approach. Only use FOR ALL ENTRIES where absolutely necessary.

1
Sandra Rossi Aug 13, 2017 at 05:41 PM
1

As Mike said, so does work FOR ALL ENTRIES. Why don't you use a one-statement join between QALS and QAVE instead? (or a join-like using the EXISTS function) By the way, I doubt your ABAP will work for what you want. By the way, what do you want to get exactly?

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

HI,

I am not getting the proper data..please check the above code.if i was wrong anthing.

0

One can't tell you what is wrong if you don't explain what you're trying to achieve, in words.

1
Former Member
Sandra Rossi

My requirement is i want the the inspection lot numbers(qave-PRUEFLOS) which are not in qals table.for this first i am selecting fields from qals table and then i am selecting fields frm qave table using for all entries in where clause i have used PRUEFLOS <> it_qals-PRUEFLOS but i am getting two tables combition data means in where clause negative condition not working...

0

Thank you.

select PRUEFLOS KZART KZART ZAEHLERV WERKS VCODE
from qave 
into table it_qave 
where NOT EXISTS ( 
select * from qals where qave~PRUEFLOS = qals-PRUEFLOS
)
AND any other selection criteria you want on qave table

PS: I don't think the condition qals~werk = '17825' fits your requirement, so I removed it. What did you try to achieve with this condition?

0
avatar image
Former Member Aug 14, 2017 at 10:03 AM
-3

use 'ne'

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 14, 2017 at 08:49 AM
-4

There are some conditions to be satisfied while using " for all entries"..

-->1)Empty "for all entries" "itab" ignores standard where clauese (means get data only when "for all entries itab table is not empty") once check it.

-->2)The FOR ALL ENTRIES comand only retrieves data which matches entries within a particular internal table.

-->3)Data type and length of for all entries matching fields should be same in both tables.

once check the above conditions and if it is not satisfied you can try with "inner join" .

Share
10 |10000 characters needed characters left characters exceeded