10-18-2006 7:16 AM
Hi,
I have a internal table with some records in it.
I need to delete the contents of this based on the condition as below.
if product_search-Resp_product_company is not initial.
SORT i_equi BY zzrefeng.
DELETE i_equi WHERE zzrefeng <> product_search-Resp_product_company.
endif.
when i execute this all the records are getting deleted irrespective of the condition mentioned.
Can anyone help me on this.
Regards,
Ram
10-18-2006 7:20 AM
hi
try by giving the sort before the <b>if</b> condition
SORT i_equi BY zzrefeng.
if product_search-Resp_product_company is not initial.
DELETE i_equi WHERE zzrefeng <> product_search-Resp_product_company.
endif.
Cheers
Alfred
10-18-2006 7:20 AM
Shouldn't it be
if <u><i><b>NOT</b></i></u> product_search-Resp_product_company is initial.
SORT i_equi BY zzrefeng.
DELETE i_equi WHERE zzrefeng <> product_search-Resp_product_company.
endif.
Regards,
Ravi
10-18-2006 7:24 AM
Hi,
If <b>not product_search-Resp_product_company is initial.</b>
sort i_equi by zzrefeng.
delete i_equi where zzrefeng ne product_search-Resp_product_company.
endif.
If again all records are deleted,just check whether your table contains same values for the field zzrefeng.
10-18-2006 7:44 AM
Hi,
If not product_search-Resp_product_company is initial.
sort i_equi by zzrefeng.
delete i_equi where <b>not</b> zzrefeng = product_search-Resp_product_company.
endif.
Kindly reward points by clicking the star on the left of reply if the reply is useful.
Message was edited by: Jayanthi Jayaraman
10-18-2006 7:24 AM
if <b>not</b> product_search-Resp_product_company is initial.
SORT i_equi BY zzrefeng.
DELETE i_equi WHERE zzrefeng <> product_search-Resp_product_company.
endif.
Regards
- Gopi
10-18-2006 7:24 AM
I think you need to check the data in the two fields zzrefeng, product_search-Resp_product_company.
The condition (zzrefeng <> product_search-Resp_product_company)that you have specified is true and thats why the data is deleted.
Best Regards,
Vibha
*Please mark all the helpful answers
10-18-2006 7:27 AM
Hi,
kindly try this code:
IF NOT product_search-resp_product_company IS INITIAL.
SORT i_equi BY zzrefeng.
LOOP AT i_equi.
IF i_equi-zzrefeng NE product_search-resp_product_company.
DELETE i_equi.
ENDIF.
ENDLOOP.
ENDIF.
hope this helps!
best regards,
Thangesh
10-18-2006 7:35 AM
Hi Ram,
1. You are right this will DELETE all records where product_search-Resp_product_company contains some value.
2. please let me know in which case you want to delete record from internal table.
Thanks.
10-18-2006 7:42 AM
Hi,
Need to delete the records if <b>ZZREFENG</b> does not have the value of <b>product_search-Resp_product_company</b> .
Here I have product_search-Resp_product_company value as FI14. And also the internal table contains some records with ZZREFENG = FI14.
I need to delete the internal table records if ZZREFENG <> FI14. But when i execute the statement it is deletng all the records even ZZREFENG = FI14 records also.
Regards,
Ram
10-18-2006 7:49 AM
I think then you need to check the way in which you have defined the two fields. Plz check their data types.
Best Regards,
Vibha
*Please mark all the helpful answers