Manage S2L partitioning

FUNCTION jitout04_set_action_intern.
ENHANCEMENT 1  YS2L_UMSTRUKTURIERUNG.
if sy-tcode eq 'S2L'.
 types: begin of t_params,
   paramval type char7,
   parampos type parampos,
   quant type char15,
   jitoline type jitodiaco,
   jitosum type  jitodiait,
 end of t_params.
 data: lt_params type table of t_params,
       wa_params like line of lt_params,
       lt_jitodiaco type jitodiaco_tt,
       ls_jitodiaco type jitodiaco,
       lv_maxoutpo type n length 10 value 0,
       lv_parampos type i, lv_quant type i,
       yjito type ref to YCL_IM_JITO_ACTION.
 create object yjito.
 loop at jitodiaco_ct[] into ls_jitodiaco.
   "keep suggested CG max:
   if ls_jitodiaco-outpo > lv_maxoutpo.
     lv_maxoutpo = ls_jitodiaco-outpo.
   endif.
   "removing trailing dot and zeroes from quant (decimal):
   write ls_jitodiaco-quant to wa_params-quant left-justified no-grouping decimals 0.
   move: wa_params-parampos to lv_parampos, wa_params-quant to lv_quant.
   "only exceeded Qts are in processing list:
   if lv_parampos < lv_quant.
     wa_params-jitoline = ls_jitodiaco.
     "assign the same teilegruppen to the components:
     read table jitodiait_ct into wa_params-jitosum index wa_params-jitoline-outpo.
     append wa_params to lt_params.
   endif.
 endloop.
 if lt_params is not initial.
   data: lv_intcycles type i, v_intcycles type i, lv_lastquant type i.
   loop at lt_params into wa_params where paramval ne 0.
     move: wa_params-quant to v_intcycles, wa_params-parampos to lv_lastquant.
     lv_intcycles = v_intcycles div lv_lastquant.
     call method yjito->addrecords
         exporting
           lastquant     = v_intcycles mod lv_lastquant
           teil          = wa_params-parampos
         changing
           jitosum       = wa_params-jitosum
           jitodiacoline = wa_params-jitoline
           intcycles     = lv_intcycles
           jitodiaco_ct  = jitodiaco_ct
           jitodiait_ct  = jitodiait_ct
           maxoutpo      = lv_maxoutpo.
   endloop.
 endif.
endif.
clear: lt_jitodiaco, ls_jitodiaco.

ADDRECORDS method

method addrecords.
if lastquant eq 0.
  jitodiacoline-quant = teil.
  modify jitodiaco_ct from jitodiacoline transporting quant where pknum = jitodiacoline-pknum.
  "rounding value is divisible by TEIL (remainder/lastquant = 0) decreasing cycles count:
  subtract 1 from intcycles.
else.
  jitodiacoline-quant = lastquant.
  modify jitodiaco_ct from jitodiacoline transporting quant where pknum = jitodiacoline-pknum.
endif.
data: i type x value 0,
      lv_outpo type char3,
      pkn type char7.
write maxoutpo to lv_outpo right-justified.
while ( i < intcycles ).
  pkn = 'R' && lv_outpo && 'Y' && i.
  add 1 to i.
  jitodiacoline-outpo = maxoutpo + i.
  jitodiacoline-quant = teil.
  jitodiacoline-jcpos = '0001'.
  "jitodiacoline-pknum = pkn.
  append jitodiacoline to jitodiaco_ct.
  jitosum-outpo = maxoutpo + i.
  append jitosum to jitodiait_ct.
endwhile.
maxoutpo = maxoutpo + intcycles.
endmethod.

Добавить комментарий



All fields are required. Your email address will not be published.