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

delete itab

Former Member
0 Likes
975

Hi Abapers,

i want to delete itab using 'in' operator but it's not supporting...

So can any one say what is the substitute for in operator?

Example Like This..

delete itab where mtart in ('HALB' 'ROH') and also

delete itab where mtart not in ('HALB' 'ROH')

Thanks...

Have a nice day..

Regards

OJP..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
953

Hi Priya,

You can try using Select options as...

SELECT-OPTIONS check_in FOR mtart NO-DISPLAY.

s_number-sign = 'I'.

s_number-option = 'EQ'.

s_number-low = 'HALB'.

APPEND check_in TO check_in.

s_number-sign = 'I'.

s_number-option = 'EQ'.

s_number-low = 'ROH'.

APPEND check_in TO check_in.

  • delete statement

Regards,

Uma

10 REPLIES 10
Read only

Former Member
0 Likes
953

Hi Priya,

try : with Comma between HALB and ROH

delete itab where mtart in ('HALB','ROH' ).

Lanka

Read only

Former Member
0 Likes
953

Use commas:

delete itab where mtart in ('HALB' , 'ROH')

Read only

0 Likes
953
RANGES range for mara-mtart.
range-sign = 'I'.
range-option = 'EQ'.
range-low = 'HALB'.
range-high = 'ROH'.
APPEND range.
DELETE : itab where mtart in range.
Read only

0 Likes
953

Hi,

ranges: r_mtart for mara-mtart.
r_mtart-sign = 'I'.
r_mtart-option = 'EQ'.
r_mtart-low = 'HALB'.
APPEND r_mtart.

r_mtart-sign = 'I'.
r_mtart-option = 'EQ'.
r_mtart-low = 'ROH'.
APPEND r_mtart.

delete itab where mtart not in r_mtart

regards

vijay

Message was edited by: Vijay Babu Dudla

Read only

Former Member
0 Likes
953

Priya,

You cannot use it like that.

Declare a variable RANGES, append all your values there and then use the IN clause. You can use I and EQ for the Sign and Option fields.

DELETE itab where MATNR in R_MATNR.

Regards,

Ravi

Note : Reward the posts that help you.

Read only

Former Member
0 Likes
954

Hi Priya,

You can try using Select options as...

SELECT-OPTIONS check_in FOR mtart NO-DISPLAY.

s_number-sign = 'I'.

s_number-option = 'EQ'.

s_number-low = 'HALB'.

APPEND check_in TO check_in.

s_number-sign = 'I'.

s_number-option = 'EQ'.

s_number-low = 'ROH'.

APPEND check_in TO check_in.

  • delete statement

Regards,

Uma

Read only

0 Likes
953

A correction to the previous post as Uma had suggested.

RANGES range for mara-mtart.

range-sign = 'I'.

range-option = 'EQ'.

range-low = 'HALB'.

APPEND range.

range-sign = 'I'.

range-option = 'EQ'.

range-low = 'ROH'.

APPEND range.

DELETE : itab where mtart <b>NOT IN</b> range.

Read only

Former Member
0 Likes
953

Performance wise, I would just recommend using two statements instead of one as follows.

DELETE itab WHERE mtart = 'HALB'.

DELETE itab WHERE mtart = 'ROH'.

Read only

former_member184495
Active Contributor
0 Likes
953

hi priya,

to my knowledge, 'IN' is replaced for 'OR'

and 'Not in' by 'AND'.

so you could try it out.

delete itab where mtart eq 'HALB' or mtart eq 'ROH'

delete itab where mtart ne 'HALB' and mtart ne 'ROH'

reward me if it was helpful.

regards,

Aditya.

Read only

Former Member
0 Likes
953

Hi All,

Kindly note that Range is not same as operator IN

e.g IN (A , B , F) .. this will delete the entries wid value as A or B or F (this represents a SET not a range)

if you use the range table between A and F it will delete all entries between A and F i.e A , B , C , D , E and F.

The best solution is the one advised by Mr. Adavi.

regards,

Sumeet Mishra,

Reward points if this helps. : )