Code:
form get_lines_tax tables c_t_accit type fmfi_t_accit
c_t_acccr structure acccr
u_t_accit_spl structure accit
u_t_accit_ext_spl structure accit_extension
u_t_acccr_spl structure acccr
using u_f_acchd type acchd
u_t_accit type accit
u_flg_rebuild type c
changing c_posnr type accit-posnr
c_first_call type c.
statics:
st_accit_spl type accit occurs 0 with header line,
sf_control_data type fmfi_control_data.
field-symbols:
<l_flg_tax_to_gl> type any,
<l_rel_ver_ext> type any,
<l_rel_ver_int> type any.
data:
l_rel_ver_ext(30) type c value 'U_T_ACCIT_EXT_SPL-REL_VER',
l_rel_ver_int(30) type c value 'C_T_ACCIT-REL_VER',
l_flg_tax_to_gl(30) type c value 'SF_CONTROL_DATA-FLG_TAX_TO_GL',
l_flg_payment_ne_30 type c value con_on,
l_flg_payment_gt_60 type c,
l_flg_payment_eq_60 type c,
l_vorgn type accit-vorgn,
l_tfill like sy-tfill.
*----- Sortierte Tabelle puffern
if not c_first_call is initial.
st_accit_spl[] = u_t_accit_spl[].
sort st_accit_spl by awtyp awref aworg buzei posnr_sd.
clear c_first_call.
endif.
read table st_accit_spl with key awtyp = u_t_accit-awtyp
awref = u_t_accit-awref
aworg = u_t_accit-aworg
buzei = u_t_accit-buzei
posnr_sd = u_t_accit-posnr_sd
binary search.
assert sy-subrc = 0.
*----- Steuerzeilen bei aktivem Splitledger
loop at st_accit_spl from sy-tabix where kstat is initial
and bstat <> 'Z'
and umskz <> 'P'
and ( buzid = 'T' or
ktosl = 'QST' or "Die nächsten 5 Einträge dienen der Quellensteuer
ktosl = 'WIT' or "da bei Quellensteuer BUZID = ' '
ktosl = 'GRU' or
ktosl = 'OFF' or
ktosl = 'OPO' or
ktosl = 'KDF' or "Die folgenden Einträge sind Differenzen wie
ktosl = 'RDF' or "Kurs und Rundungsdifferenzen
ktosl = 'ZDI' )
and xref1 <> fmfi_con_euro_fi
and xref3 <> con_category_isps
and xref3 <> con_category_eaps.
if st_accit_spl-awtyp <> u_t_accit-awtyp or
st_accit_spl-awref <> u_t_accit-awref or
st_accit_spl-aworg <> u_t_accit-aworg or
st_accit_spl-buzei <> u_t_accit-buzei or
st_accit_spl-posnr_sd <> u_t_accit-posnr_sd.
exit.
endif.
*------ Neue Positionsnummer für die gesplitteten Steuerzeilen
add 1 to c_posnr.
*------ ACCIT
perform create_lines tables st_accit_spl
c_t_accit
using u_f_acchd
c_posnr
u_flg_rebuild
changing l_vorgn
l_flg_payment_ne_30
l_flg_payment_gt_60
l_flg_payment_eq_60.
append c_t_accit.
*----- New Tax update
if sf_control_data-bukrs <> st_accit_spl-bukrs.
call function 'FMCA_GET_INIT_INFO'
exporting
i_bukrs = st_accit_spl-bukrs
changing
c_f_control_data = sf_control_data.
endif.
assign (l_flg_tax_to_gl) to <l_flg_tax_to_gl>.
if sy-subrc = 0.
if not <l_flg_tax_to_gl> is initial.
read table u_t_accit_ext_spl with key awtyp = st_accit_spl-awtyp
awref = st_accit_spl-awref
aworg = st_accit_spl-aworg
posnr = st_accit_spl-posnr
binary search.
assert sy-subrc = 0.
assign (l_rel_ver_ext) to <l_rel_ver_ext>.
if sy-subrc = 0.
if not <l_rel_ver_ext> is initial.
describe table c_t_accit lines l_tfill.
read table c_t_accit index l_tfill.
assign (l_rel_ver_int) to <l_rel_ver_int>.
<l_rel_ver_int> = <l_rel_ver_ext>.
modify c_t_accit index l_tfill.
endif.
endif.
endif.
endif.
read table u_t_acccr_spl with key awtyp = st_accit_spl-awtyp "1114314
awref = st_accit_spl-awref
aworg = st_accit_spl-aworg
posnr = st_accit_spl-posnr
binary search.
assert sy-subrc = 0.
loop at u_t_acccr_spl from sy-tabix.
if u_t_acccr_spl-awtyp <> st_accit_spl-awtyp or
u_t_acccr_spl-awref <> st_accit_spl-awref or
u_t_acccr_spl-aworg <> st_accit_spl-aworg or
u_t_acccr_spl-posnr <> st_accit_spl-posnr.
exit.
endif.
u_t_acccr_spl-posnr = c_posnr.
append u_t_acccr_spl to c_t_acccr.
endloop.
endloop.
endform. " GET_LINES_TAX