Application Development 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: 

For all entries not working in negative where clause

0 Kudos

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 REPLIES 10

pokrakam
Active Contributor

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_i...

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

0 Kudos

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...

matt
Active Contributor

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

Sandra_Rossi
Active Contributor

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?

0 Kudos

HI,

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

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

0 Kudos

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 Kudos

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?

Former Member
0 Kudos

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" .

Former Member
0 Kudos

use 'ne'