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 line from itab

Former Member
0 Kudos
92

hi friends,

i want to delete a line from itab when sy-surc <> 0.can any one give me complete code.

regards

veera

8 REPLIES 8

Former Member
0 Kudos
62

data : aa like sflight occurs 1 with header line.

select * into table aa from sflight.

delete aa index 1.

0 Kudos
62

hi'

i want to delete when my condtion sy-subrc <>0

0 Kudos
62

Can you please specify the complete request as sy-subrc <> 0 does not make sense...

Sy-Subrc is a system parameter which is gets a value depending on the performed operation. So you just can't that using it as a where condition.

Are you trying to do something like the below ...

loop at itab1.

read table itab2 with key f1 = itab1-f1.

if sy-subrc <> 0.

delete itab1.

endif.

endloop.

0 Kudos
62

Instead if you know the line numbers of row you want to delete then directly write as :

DELETE <ITAB> [FROM <Line N1>] [TO <Line N2>] [WHERE <condition>]. //Deletes multiple line in internal table

DELETE ITAB Index<N1> //N1 is line/row number

0 Kudos
62

Hi Veera

Use as per the syntax provided in my earlier post when SY-SUBRC ne 0 orelse provide your code for a better solution.

Kind Regards

Eswar

Former Member
0 Kudos
62

Most commonly used:

DELETE itab [FROM wa] [INDEX idx] [WHERE <cond>].

Kind Regards

Eswar

Former Member
0 Kudos
62

LOOP AT ITAB .

......

........// some processing

.......

IF SY_SUBRC NE 0.

DELETE <ITAB> index sy-tabix.

// this statement deletes the particular row from internal table

ENDLOOP.

Former Member
0 Kudos
62

Hi,

U may delete data from internal table with following syntex:

DELETE itab where condition.

Cheers.