Skip to Content
avatar image
-2
Former Member

For all entries not working in negative where clause

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Aug 13, 2017 at 04:46 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 13, 2017 at 05:41 PM

    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?

    Add comment
    10|10000 characters needed characters exceeded

    • 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?

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

    use 'ne'

    Add comment
    10|10000 characters needed 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" .

    Add comment
    10|10000 characters needed characters exceeded