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 internal table

Former Member
0 Likes
507

Hai Friends,

I want to delete my internal table if MATNR starts like 'GT' and with someother condition also. Two conditions in a delete.

3 REPLIES 3
Read only

Former Member
0 Likes
470

Hi

when i use delete itab with where clause i don`t see many issues ,infact i tried it in a code it was working faster than loop endloop.

make sure you are not using any negative conditions in your where clause.

Regards

Neha

Read only

Former Member
0 Likes
470

hI Vennila,

Use the following

delete itab where matnr cp 'GT*'.

IF SY-SUBRC IS INITIAL.

ENDIF.

DATA : itab TYPE TABLE OF mara WITH HEADER LINE.

*SELECT * FROM mara INTO TABLE itab UP TO 100 ROWS.

itab-matnr = 'GTAHBB999'.

ITAB-ERNAM = 'RAM'.

APPEND ITAB.

CLEAR ITAB.

IF sy-subrc IS INITIAL.

DELETE itab[] WHERE matnr CP 'GT' AND ERNAM CP 'R'.

IF sy-subrc IS INITIAL.

ENDIF.

ENDIF.

for further info please go through the KEY word docu

Regards

Ramchander Rao.K

Edited by: ramchander krishnamraju on Dec 5, 2008 5:22 AM

Edited by: ramchander krishnamraju on Dec 5, 2008 5:23 AM

Read only

Former Member
0 Likes
470

hi,

DELETE itab WHERE matnr like 'GT%' and <condition2> and <condition3>.

'GT%' means start with GT in matnr field. You can use N no of condition in WHERE clause by using logical operator like AND OR.