‎2008 Mar 11 5:54 AM
i am using the code to delete rows from internal table that are not having any values in this particular field. but it is giving an dump.
what is wrong here?
loop at t_data7 into wa_data7.
if wa_data7-total_turnover eq 0
AND wa_data7-total_current eq 0
AND wa_data7-total_current1 eq 0
AND wa_data7-total_current2 eq 0
AND wa_data7-total_current3 eq 0
AND wa_data7-total_current4 eq 0
AND wa_data7-total_current5 eq 0.
DELETE t_data7 from wa_data7.
clear wa_data7.
else.
wa_turnover = wa_data7.
append wa_turnover to t_turnover.
endif.
endloop.
‎2008 Mar 11 5:57 AM
Hi
Insted of DELETE t_data7 from wa_data7.
Use
DELETE table t_data7 from wa_data7.
or
DELETE t_data7 index sy-tabix.
Regards
Aditya
‎2008 Mar 11 5:58 AM
Loop at t_data into wa_Data.
v_index = sy-tabix.
if t_data----- is initial.
delete t_Data index v_index.
endif.
endloop.
Use this coding to delete the records from internal table.
‎2008 Mar 11 6:10 AM
Hi,
Modify the statement,
DELETE t_data7 from wa_data7.
as,
Delete t_data7 index sy-tabix.
Your code should work fine.
Reward if helpful.
Regards.
‎2008 Mar 11 6:13 AM
Hi,
Use table in the DELETE statement and it will work.
loop at t_data7 into wa_data7.
if wa_data7-total_turnover eq 0
AND wa_data7-total_current eq 0
AND wa_data7-total_current1 eq 0
AND wa_data7-total_current2 eq 0
AND wa_data7-total_current3 eq 0
AND wa_data7-total_current4 eq 0
AND wa_data7-total_current5 eq 0.
DELETE table t_data7 from wa_data7.
clear wa_data7.
else.
wa_turnover = wa_data7.
append wa_turnover to t_turnover.
endif.
endloop.
mark all helpful answers.
‎2008 Mar 11 6:19 AM
Try using DELETE TABLE t_data7 from wa_data7.
As per SAP documentation,
DELETE dbtab .
Effect:
For dbtab, a database table defined in the ABAP Dictionary or a view defined in the ABAP Dictionary can be specified.
Only views that refer to a single database table, and whose maintenance status in the ABAP Dictionary permits change access can be specified.
DELETE itab FROM idx1.
Effect
If you specify FROM, all the table rows from the table index idx1 onwards are included. idx1 must be a data object with type i. If the value of idx1 is less than or equal to 0, a runtime error occurs. If the value is greater than the number of table rows, no rows are deleted.
Hope this helps.
Thanks,
Balaji
‎2008 Mar 11 6:26 AM
Hi,
Use Keyword IS INITIAL this means the entries are null
Try...
if wa_data7-total_turnover is initial.
-
-
,....................
endif..
Regards,
kavitha
‎2008 Mar 11 6:30 AM
Hi,
You can use below and for better performance.
delete t_data7 where total_turnover eq 0
AND total_current eq 0
AND total_current1 eq 0
AND total_current2 eq 0
AND total_current3 eq 0
AND total_current4 eq 0
AND total_current5 eq 0.
t_turnover [] = t_data7 [].
Thanks,
Sriram Ponna.
Edited by: Sriram Ponna on Mar 11, 2008 12:24 PM
‎2008 Mar 11 6:30 AM
Hi
try like this
DELETE t_data7[] where total_turnover eq 0
AND total_current1 eq 0
AND total_current2 eq 0
AND total_current3 eq 0
AND total_current4 eq 0
AND total_current5 eq 0.
it_turtnover[] = t_data7[]
this will much faster than loop
try this
Regards
Shiva
Edited by: Shivakumar Hosaganiger on Mar 11, 2008 12:01 PM