‎2009 Jan 15 9:45 AM
Hi All i have used delete statement as shown below
DELETE t_output WHERE remain_invoice NOT IN s_invo[].
t_output is my internal table .
Error message in code inspector is :Sequential read access for a standard table
What should i do ?
‎2009 Jan 15 9:50 AM
are you deleting data from internal table or database table?
For internal table use addition DELETE TABLE....
‎2009 Jan 15 9:55 AM
hi,
i think you should not do this.
try .
loop at t_output.
vtabix = sy-tabix.
read table s_invo with key low = t_output-remain_invoice .
if sy-subrc ne 0.
delete t_output index vtabix.
endif.
endloop.
this wont lead any performance issue.
‎2009 Jan 15 10:05 AM
I think its better to avoid delete statements inside the loop
instead of using delete statement inside the loop
use
delete table itab where condition
or
if u have to use loop at any cost
modify internal table with flag=X
and then delete all records from the itab at one shot using above statement
Regards
Vikas C
‎2009 Jan 15 10:24 AM
Hi Manisha,
We should not do delete inside loop.
It will degrade performance.
Regards
Sandipan
‎2020 Mar 09 3:17 PM
There's 2 more and I'd really appreciate your inputs.
1.) LOOP AT lt_plaf
ASSIGNING FIELD-SYMBOL(<fs_plaf>).
READ TABLE lt_zmrp
INTO DATA(ls_zmrp)
WITH KEY cno_order = <fs_plaf>-plnum+3(7).
IF sy-subrc NE 0.
MOVE abap_true TO <fs_plaf>-xdel .
ENDIF.
ENDLOOP.
DELETE lt_plaf
WHERE xdel EQ abap_true.
2.) SELECT ordid
FROM /bmw/ts_1143_log AS a
WHERE ordid IN @s_ordid
AND order_comp_flag EQ @space
AND
EXISTS ( SELECT *
FROM zmrp
WHERE cno_order EQ a~ordid
AND cid_status IN @s_status
AND cno_assyl IN @s_assyl )
INTO TABLE @gt_log.
IF sy-subrc EQ 0.
SORT gt_log
BY ordid.
DELETE ADJACENT DUPLICATES FROM gt_log
COMPARING ordid ##CI_SORTED.
ENDIF.