Skip to Content
0
Former Member
Oct 20, 2006 at 06:48 AM

Code not Working: Please advice corrections..

14 Views

Dear All,

I am working with the following code in order to delete all those records from my ztable (zvdelivery1) that do not have the MATNR (mat.no.) of 18 characters. In other words I wish to delete the corrupt data from this table but there is something wrong with this code as it's not deleting the said data.

Kindly have a look and advise the corrections.

Regards,

Alok.

start-of-selection.

select amatnr abox_no adat aexcise_from aexcise_to abox_size1

into corresponding fields of table itab

from zvdelivery1 as a where

plant eq '1010'.

loop at itab.

count = strlen( itab-matnr ).

if count lt 18.

main_table-matnr = itab-matnr.

main_table-box_no = itab-box_no.

main_table-dat = itab-dat.

main_table-excise_from = itab-excise_from.

main_table-excise_to = itab-excise_to.

main_table-box_size1 = itab-box_size1.

append main_table.

endif.

endloop.

loop at main_table.

DELETE from zvdelivery1

WHERE MATNR = MAIN_TABLE-MATNR AND

BOX_NO = main_table-box_no.

ENDLOOP.

end-of-selection.