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 single record from internale table

Former Member
0 Kudos

How to delete single record in an internal table.

9 REPLIES 9

Former Member
0 Kudos

delete itab where your_condition_here.

Former Member
0 Kudos

Hi,

Delete ITAB index 1.

or

Loop at ITAB.

delete itab.

exit.

endloop.

Darren

Former Member
0 Kudos

Hi,

When you say you want to delete a single record from an internal table, on what basis are you deleting it ?

If you have a specific condition in mind you can write the following code.

Read table t_test with key (cond).

(Assuming t_test has a header line).

Delete t_test index sy-index.

Regards,

Pramod

Former Member
0 Kudos

delete itab where <your condititon>

(or)

delete itab from wa--> work area.

(or)

delete itab index 3.

delete ita index 4.

For more examples place cursor on keyword DELETE ITAB and press F1 key

Former Member
0 Kudos

Hi,

there are several ways of doing this:

1.delete itab where <condition>

Former Member
0 Kudos

hi Lavanya,,

If in your Internal table having 10 records ,

F1

-


1

2

3

4

5

6

7

8

9

10

if you want to delete 5th record :

Delete itab where f1 = '5'.

Click F1 on delete in you program .. and you will get many options. dude

Thanks : Maddy

Former Member
0 Kudos

HI,

deleteion can be done on the basis of some condition:

loop at itab.

delete itab where field = ' '.

endloop.

this will work..

Former Member
0 Kudos

LOOP AT ist_bkpf INTO wa_bkpf.

READ TABLE ist_payr INTO wa_payr WITH KEY vblnr = wa_bkpf-belnr gjahr = wa_bkpf-gjahr.

IF sy-subrc = 0.

DELETE ist_bkpf.

ENDIF.

ENDLOOP.

hope this will help u

Former Member
0 Kudos

Hi,

One best thing we can do while writing code we an have F1 help when we write the code.

plz check the below examples to delete entry from internal table :

DELETE TABLE itab WITH TABLE KEY matnr = p_matnr.

DELETE TABLE itab FROM wa_mara.

READ TABLE itab WITH TABLE KEY matnr = p_matnr 
                     TRANSPORTING NO FIELDS. 

IF sy-subrc = 0. 
  DELETE itab INDEX sy-tabix. 
ENDIF.

thanx.