Application Development and Automation 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: 
Read only

Help on Delete Internal table records

Former Member
0 Likes
1,144

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

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 REPLIES 10
Read only

Former Member
0 Likes
1,110

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

Read only

Former Member
0 Likes
1,110

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

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,110

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.

Read only

0 Likes
1,110

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

Read only

gopi_narendra
Active Contributor
0 Likes
1,110

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

Read only

Former Member
0 Likes
1,110

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

Read only

Former Member
0 Likes
1,110

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

Read only

Former Member
0 Likes
1,110

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.

Read only

0 Likes
1,110

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

Read only

Former Member
0 Likes
1,110

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