2006 Nov 07 2:34 PM
hi friends,
i want to delete a line from itab when sy-surc <> 0.can any one give me complete code.
regards
veera
2006 Nov 07 2:38 PM
data : aa like sflight occurs 1 with header line.
select * into table aa from sflight.
delete aa index 1.
2006 Nov 07 2:40 PM
2006 Nov 07 2:44 PM
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.
2006 Nov 07 2:45 PM
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
2006 Nov 07 2:45 PM
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
2006 Nov 07 2:38 PM
Most commonly used:
DELETE itab [FROM wa] [INDEX idx] [WHERE <cond>].
Kind Regards
Eswar
2006 Nov 07 2:41 PM
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.
2006 Nov 07 2:42 PM
Hi,
U may delete data from internal table with following syntex:
DELETE itab where condition.
Cheers.