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

Re: I want to delete last six months data from a table

$
0
0

*Declare local Range:

    Data:LR_date type range of sy-datum,

    Ls_date like line of  lr_date,

   Lv_lowdate type sy-datum,

lv_highdate type sy-datum.

 

*Get the last posting date

selectmax( businessdaydate ) from ztran_balchk_log into lv_highdate. " this will affect the performance


*now you know the last posting data(lv_highdate).

Lv_lowdate = you have last post date(lv_highdate) –  6 months.

 

* it should delete last 6 months data .

   Ls_date-low = Lv_lowdate.

   Ls_date-high = lv_highdate.

   Ls_date-option = ‘BT’.

   Ls_date-sign = ‘I’.

  Append Ls_date to lr_date.

 

* now get the six months data from ztable:

 

Select * from ztable into itab where business datein  lr_date.

 

If sy-subrc is initial.

DELETE TABLE ztable from itabl.

  If sy-subrc is initial.

    Write: ‘success’.

  endif.

endif.


Viewing all articles
Browse latest Browse all 8689

Trending Articles



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