Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9021

Re: deleting records from internal table

$
0
0

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.


Viewing all articles
Browse latest Browse all 9021

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>