Split ranges

data : lv_count  type i,
lv_max    type i,
lv_min    type i,
ranges: rng_vbelv for vbfa-vbelv.
ranges: lrng_vbelv for vbfa-vbelv.  "local range.

clear: lv_count, lv_max.
lv_min = 0.
describe table rng_vbelv lines lv_count.
while lv_max lt lv_count.
  lv_max = lv_min + 1000.
  if lv_max gt lv_count.
    lv_max = lv_count.
  refresh lrng_vbelv.
  loop at rng_vbelv from lv_min to lv_max.
    append rng_vbelv to lrng_vbelv.
  lv_min = lv_max.
  select b~vbeln a~vbelv b~wadat_ist b~kunnr b~ernam b~erzet b~erdat
  appending table lt_itab
  from vbfa as a
  inner join likp as b
  on a~vbeln eq b~vbeln
  where a~vbelv in lrng_vbelv
  order by b~vbeln.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.