Hi Gurudatt,
Saurabh's code is fine as far above entries are concerned.
But it will not work if there are two entries of calmonth with both flag <> ' X.
try below code.
itab2[] = itab1[]. "copy itab1 to itab2. delete itab2 where flag<>'X'. "entries with flag= X in itab2. loop at itab2 into wa2. read itab1 into wa1 comparing wa1 -calmonth= wa2-calmonth wa1-flag <> 'X'. "same calmonth as of itab2 but not flag = X.(duplicate calmonth). if sy-subrc = 0. " if found. delete itab1 where flag = 'X' AND calmonth = wa2-calmonth. endif. endloop. thus itab1 will have required records. Harshawardhan.