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: 

loop at where not in

Former Member
0 Kudos

can anybody send me example of NOT IN with loop at itab where filed not in (a, ,b, c )

when i use brackets becomes red..i dont know why

7 REPLIES 7

Former Member
0 Kudos

Use OR/AND instead of IN

Regards

Vinod

SuhaSaha
Advisor
Advisor
0 Kudos

I think you are missing a space & have added an additional comma.

LOOP AT itab WHERE field NOT IN ( a, b, c ).
"Processing
ENDLOOP.

Former Member
0 Kudos

you can use like

LOOP AT IT_ITAB INTO WA_ITAB WHERE FIELD NE 'A' OR FIELD NE 'B'.

ENDLOOP.

Former Member
0 Kudos

else you can got this way:

Loop at itab.
          If <field> CO  'a,b,c'
          exit.
          else.
          <<--------Processing
         endif.

Former Member
0 Kudos

Hi,

You can write like the below mentioned method also

LOOP AT ITAB INTO WA WHERE FLD NE ( FLD1, FLD1.1, FLD1.2 )

Endloop.

Check and let me know

Former Member
0 Kudos

Code like the way below;


data: st_tab type table of selopt with header line.
    st_tab-sign = 'I'.
    st_tab-option = 'EQ'.
    st_tab-low = 'A'.
    append st_tab. clear st_tab.

    st_tab-sign = 'I'.
    st_tab-option = 'EQ'.
    st_tab-low = 'B'.
    append st_tab. clear st_tab.

    st_tab-sign = 'I'.
    st_tab-option = 'EQ'.
    st_tab-low = 'C'.
    append st_tab. clear st_tab.

    loop at itab not in st_tab.

    endloop.

ThomasZloch
Active Contributor
0 Kudos

Please consult ABAP online documentation before posting.

Thread locked.

Thomas