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: 

delete itab contents.,

naveen_inuganti2
Active Contributor
0 Kudos

Hi.,

I am having one internal table with more than 50 Records.

FIELD1 is one of the field in that internal table,

It may contains contents like AAA, BBB, CCC, DDD or EEE.

So here I want to delete Internal table entries where that FILED1 eq BBB and FIELD1 eq CCC.

So we can write this as:

delete itab where FIELD1 = 'BBB'.
delete itab where FIELD1 = 'CCC'.

How can I solve this with one statement?

---Naveen Inuganti.

6 REPLIES 6

Former Member
0 Kudos

HI,

You can write

delete itab where FIELD1 in ( 'BBB' ,'CCC' ). .

regards,

Lokesh.

0 Kudos

Are you sure? Its not working Lokesh!

Former Member
0 Kudos

delete itab where FIELD1 = 'BBB' or FIELD1 = 'CCC'

naveen_inuganti2
Active Contributor
0 Kudos

Answer:

delete itab where fld2 eq 'AAA' or fld2 eq 'CCC'.

Thanks,

Naveen.I

Former Member
0 Kudos

Hi Naveen,

Do it this way:

delete itab where FIELD1 = 'BBB' or FIELD1 = 'CCC'.

With luck,

Pritam.

Former Member
0 Kudos

Hi,

You can specify DELETE seats_tab where CARRID = 'AZ' or CARRID = 'DL'.

You cna check in same line.

tables: sflight.

select-options: p_carrid for sflight-carrid,

p_connid for sflight-connid.

DATA: BEGIN OF seats,

carrid TYPE sflight-carrid,

connid TYPE sflight-connid,

fldate TYPE sflight-fldate,

seatsocc TYPE sflight-seatsocc,

seatsmax TYPE sflight-seatsmax,

seatsfree TYPE sflight-seatsocc,

END OF seats.

DATA seats_tab LIKE STANDARD TABLE OF seats.

SELECT carrid connid fldate seatsocc seatsmax

FROM sflight

INTO TABLE seats_tab

WHERE carrid in p_carrid AND

connid in p_connid.

LOOP AT seats_tab INTO seats.

seats-seatsfree = seats-seatsmax - seats-seatsocc.

MODIFY seats_tab INDEX sy-tabix FROM seats.

ENDLOOP.

SORT seats_tab BY carrid.

DELETE seats_tab where CARRID = 'AZ' or CARRID = 'DL'.

if sy-subrc = 0.

endif.

Regards,

Sunil