ALV双表头
************************************************************************
* PROGRAM ID/NAME: ZFIR_ACCOUNT_BALANCE DATE WRITTEN: 2009.11.02
* AUTHOR'S NAME:
* PROGRAM TITLE: 汇总式总账
* PROJECT NAME:
* VERSION: 1.0
*----------------------------------------------------------------------*
report zfir_account_balance_rv no standard page heading line-size 150.
*&---------------------------------------------------------------------*
*& TABLES:
*&---------------------------------------------------------------------*
tables:ska1,glt0,glfunct,t001.
*&---------------------------------------------------------------------*
*& VARIABLES DECLARATION
*&---------------------------------------------------------------------*
data:g_year(4),
g_monat(2),
g_ktopl like t001-ktopl.
*&---------------------------------------------------------------------*
* INTERNAL TABLE DECLARATION
*&---------------------------------------------------------------------*
data:begin of it_itab occurs 0,
year(4),
monat(2),
bukrs like t001-bukrs,
ktoks like ska1-ktoks, "科目组
func_area like ska1-func_area, "功能范围
fkbtx like tfkbt-fkbtx, "功能范围的名称
racct like glt0-racct, "科目
* txt20 LIKE skat-txt20, "科目描述
* txt20 LIKE skat-txt50, "科目描述
txt20(60), "科目描述
* hslvt_c LIKE glt0-hslvt, "年初余额
hslvt_qms like glt0-hslvt, "本年累计期末借方
hslvt_qmh like glt0-hslvt, "本年累计期末贷方
hslvt_bqs like glt0-hslvt, " 本期发生借方
hslvt_bqh like glt0-hslvt, " 本期发生贷方
hslvt_qcs like glt0-hslvt, "本年累计期初借方
hslvt_qch like glt0-hslvt, "本年累计贷期初方
hslvt_m like glt0-hslvt, "期末余额
text01(26), "功能范围科目代码
text02 type text50, "功能范围科目描述
* added by wangzhuo begin
saknr type saknr,
* added by wangzhuo end
end of it_itab.
data:begin of it_display occurs 0,
* added by wangzhuo 2014/02/24 begin
saknr like skat-saknr, " 科目号
* added by wangzhuo 2014/02/24 end
racct like glt0-racct, "科目
hslvt_qms like glt0-hslvt, "本年累计期末借方
hslvt_qmh like glt0-hslvt, "本年累计期末贷方
hslvt_bqs like glt0-hslvt, " 本期发生借方
hslvt_bqh like glt0-hslvt, " 本期发生贷方
hslvt_qcs like glt0-hslvt, "本年累计期初借方
hslvt_qch like glt0-hslvt, "本年累计贷期初方
text02 type text50, "功能范围科目描述
end of it_display.
data:it_skat like skat occurs 0 with header line,
it_tfkbt like tfkbt occurs 0 with header line,
it_glt0 like glt0 occurs 0 with header line,
it_glfunct like glfunct occurs 0 with header line.
*&---------------------------------------------------------------------*
*& SELECT-OPTIONS
*&---------------------------------------------------------------------*
selection-screen begin of block b1 with frame title text-001.
parameters: p_bukrs like glt0-bukrs obligatory,
p_monat(6) obligatory default sy-datum+0(6).
* p_saknr like ska1-saknr.
selection-screen comment 40(30) text-002.
*SELECT-OPTIONS s_saknr FOR ska1-saknr.
selection-screen end of block b1.
*----------------------------------------------------------------------*
*AT SELECTION-SCREEN
*----------------------------------------------------------------------*
at selection-screen.
perform frm_authority_check.
perform frm_sel_screen. "Authority check
*----------------------------------------------------------------------*
*START-OF-SELECTION
*----------------------------------------------------------------------*
start-of-selection.
perform frm_select_data.
perform frm_process_data.
*----------------------------------------------------------------------*
*END-OF-SELECTION
*----------------------------------------------------------------------*
end-of-selection.
* if it_itab[] is initial.
* message i001(00) with text-006.
* exit.
* else.
perform frm_output_data.
* endif.
*&---------------------------------------------------------------------*
*& Form FRM_SEL_SCREEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_sel_screen .
data:l_tipo like dd01v-datatype.
**公司代码权限检查
select single ktopl into g_ktopl from t001 where bukrs eq p_bukrs.
if sy-subrc <> 0.
message e001(00) with text-003 p_bukrs.
stop.
else.
authority-check object 'F_BKPF_BUK'
id 'BUKRS' field p_bukrs
id 'ACTVT' field '03'.
if sy-subrc <> 0.
message e001(00) with text-004 p_bukrs.
endif.
endif.
**查询年月检查
g_year = p_monat+0(4).
g_monat = p_monat+4(2).
call function 'NUMERIC_CHECK'
exporting
string_in = p_monat
importing
string_out = p_monat
htype = l_tipo.
if l_tipo ne 'NUMC' or g_monat > '12' or
g_year < '1999' or g_year > '9999'.
message e001(00) with text-005.
endif.
endform. " FRM_SEL_SCREEN
*&---------------------------------------------------------------------*
*& Form FRM_SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_select_data.
data:lt_itab like it_itab occurs 0 with header line.
clear:it_itab,it_glt0,it_glfunct,it_skat,it_tfkbt.
refresh:it_itab,it_glt0,it_glfunct,it_skat,it_tfkbt.
**取科目等
select ktoks saknr as racct
into corresponding fields of table it_itab
from ska1
where ktopl eq g_ktopl
and ktoks in ('1000','2000','4000','5000','9000') .
if it_itab[] is not initial.
**取资产类科目余额
select * into corresponding fields of table it_glt0
from faglflext
for all entries in it_itab
where rbukrs eq p_bukrs
and ryear eq g_year
and racct eq it_itab-racct .
**取科目描述
select * into corresponding fields of table it_skat
from skat
for all entries in it_itab
where spras eq sy-langu
and ktopl eq g_ktopl
and saknr eq it_itab-racct.
lt_itab[] = it_itab[].
delete lt_itab where ktoks ne '5000'.
if lt_itab[] is not initial.
**取损益类科目余额
select * into corresponding fields of table it_glfunct
from faglflext
for all entries in lt_itab
where ryear eq g_year
and rbukrs eq p_bukrs
and racct eq lt_itab-racct.
**取功能范围描述
if it_glfunct[] is not initial.
select * into corresponding fields of table it_tfkbt
from tfkbt
for all entries in it_glfunct
where spras eq sy-langu
and fkber eq it_glfunct-rfarea.
endif.
endif.
endif.
clear:lt_itab.refresh:lt_itab.
sort it_itab by racct.
sort it_glt0 by racct.
sort it_glfunct by racct.
sort it_skat by saknr.
sort it_tfkbt by fkber.
endform. " FRM_SELECT_DATA
*&---------------------------------------------------------------------*
*& Form frm_process_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_process_data .
data:l_hslvt like glt0-hslvt."期末
data:l_hslvt_c like glt0-hslvt."期初
data: l_hslvt_b like glt0-hslvt."本期发生额
data:lt_itab like it_itab occurs 0 with header line.
loop at it_itab.
it_itab-year = g_year.
it_itab-monat = g_monat.
it_itab-bukrs = p_bukrs.
**取科目描述
read table it_skat with key saknr = it_itab-racct binary search.
if sy-subrc = 0.
it_itab-txt20 = it_skat-txt50.
* added by wangzhuo begin
it_itab-saknr = it_skat-saknr.
* added by wangzhuo end
endif.
loop at it_glt0 where racct eq it_itab-racct.
clear:l_hslvt,l_hslvt_c.
**年初余额
* it_itab-hslvt_c = it_itab-hslvt_c + it_glt0-hslvt.
**资产类
if it_itab-ktoks ne '5000'.
clear:it_itab-func_area.
case g_monat.
when '1' or '01'.
l_hslvt = it_glt0-hsl01.
l_hslvt_b = it_glt0-hsl01.
when '2' or '02'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02.
l_hslvt_c = l_hslvt - it_glt0-hsl02.
l_hslvt_b = it_glt0-hsl02.
when '3' or '03'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03.
l_hslvt_c = l_hslvt - it_glt0-hsl03.
l_hslvt_b = it_glt0-hsl03.
when '4' or '04'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04.
l_hslvt_c = l_hslvt - it_glt0-hsl04.
l_hslvt_b = it_glt0-hsl04.
when '5' or '05'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05.
l_hslvt_c = l_hslvt - it_glt0-hsl05.
l_hslvt_b = it_glt0-hsl05.
when '6' or '06'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05 + it_glt0-hsl06.
l_hslvt_c = l_hslvt - it_glt0-hsl06.
l_hslvt_b = it_glt0-hsl06.
when '7' or '07'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05 + it_glt0-hsl06 +
it_glt0-hsl07.
l_hslvt_c = l_hslvt - it_glt0-hsl07.
l_hslvt_b = it_glt0-hsl07.
when '8' or '08'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05 + it_glt0-hsl06 +
it_glt0-hsl07 + it_glt0-hsl08.
l_hslvt_c = l_hslvt - it_glt0-hsl08.
l_hslvt_b = it_glt0-hsl08.
when '9' or '09'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05 + it_glt0-hsl06 +
it_glt0-hsl07 + it_glt0-hsl08 + it_glt0-hsl09.
l_hslvt_c = l_hslvt - it_glt0-hsl09.
l_hslvt_b = it_glt0-hsl09.
when '10'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05 + it_glt0-hsl06 +
it_glt0-hsl07 + it_glt0-hsl08 + it_glt0-hsl09 +
it_glt0-hsl10.
l_hslvt_c = l_hslvt - it_glt0-hsl10.
l_hslvt_b = it_glt0-hsl10.
when '11'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05 + it_glt0-hsl06 +
it_glt0-hsl07 + it_glt0-hsl08 + it_glt0-hsl09 +
it_glt0-hsl10 + it_glt0-hsl11.
l_hslvt_c = l_hslvt - it_glt0-hsl11.
l_hslvt_b = it_glt0-hsl11.
when '12'.
l_hslvt = it_glt0-hsl01 + it_glt0-hsl02 + it_glt0-hsl03 +
it_glt0-hsl04 + it_glt0-hsl05 + it_glt0-hsl06 +
it_glt0-hsl07 + it_glt0-hsl08 + it_glt0-hsl09 +
it_glt0-hsl10 + it_glt0-hsl11 + it_glt0-hsl12 +
it_glt0-hsl13 + it_glt0-hsl14 + it_glt0-hsl15 +
it_glt0-hsl16.
l_hslvt_c = l_hslvt - it_glt0-hsl12 - it_glt0-hsl13 -
it_glt0-hsl14 - it_glt0-hsl15 - it_glt0-hsl16.
l_hslvt_b = it_glt0-hsl12 + it_glt0-hsl13 + it_glt0-hsl14 +
it_glt0-hsl15 + it_glt0-hsl16..
when others.
endcase.
**本年累计借方/贷方
if it_glt0-drcrk = 'S'.
it_itab-hslvt_qms = it_itab-hslvt_qms + l_hslvt.
it_itab-hslvt_qcs = it_itab-hslvt_qcs + l_hslvt_c.
it_itab-hslvt_bqs = it_itab-hslvt_bqs + l_hslvt_b.
else.
l_hslvt = 0 - l_hslvt.
l_hslvt_c = 0 - l_hslvt_c.
l_hslvt_b = 0 - l_hslvt_b.
it_itab-hslvt_qmh = it_itab-hslvt_qmh + l_hslvt.
it_itab-hslvt_qch = it_itab-hslvt_qch + l_hslvt_c.
it_itab-hslvt_bqh = it_itab-hslvt_bqh + l_hslvt_b.
endif.
endif.
endloop.
**资产类
if it_itab-ktoks ne '5000'.
**期末余额
* it_itab-hslvt_m = it_itab-hslvt_c + it_itab-hslvt_s - it_itab-hslvt_h.
it_itab-text01 = it_itab-racct.
it_itab-text02 = it_itab-txt20.
move-corresponding it_itab to lt_itab.
append lt_itab.
clear:it_itab,lt_itab.
**损益类
else.
loop at it_glfunct where racct eq it_itab-racct.
clear:l_hslvt.
case g_monat.
when '1' or '01'.
l_hslvt = it_glfunct-hsl01.
l_hslvt_b = it_glfunct-hsl01.
when '2' or '02'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02.
l_hslvt_c = l_hslvt - it_glfunct-hsl02.
l_hslvt_b = it_glfunct-hsl02.
when '3' or '03'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03.
l_hslvt_c = l_hslvt - it_glfunct-hsl03.
l_hslvt_b = it_glfunct-hsl03.
when '4' or '04'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04.
l_hslvt_c = l_hslvt - it_glfunct-hsl04.
l_hslvt_b = it_glfunct-hsl04.
when '5' or '05'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05.
l_hslvt_c = l_hslvt - it_glfunct-hsl05.
l_hslvt_b = it_glfunct-hsl05.
when '6' or '06'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05 + it_glfunct-hsl06.
l_hslvt_c = l_hslvt - it_glfunct-hsl06.
l_hslvt_b = it_glfunct-hsl06.
when '7' or '07'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05 + it_glfunct-hsl06 +
it_glfunct-hsl07.
l_hslvt_c = l_hslvt - it_glfunct-hsl07.
l_hslvt_b = it_glfunct-hsl07.
when '8' or '08'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05 + it_glfunct-hsl06 +
it_glfunct-hsl07 + it_glfunct-hsl08.
l_hslvt_c = l_hslvt - it_glfunct-hsl08.
l_hslvt_b = it_glfunct-hsl08.
when '9' or '09'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05 + it_glfunct-hsl06 +
it_glfunct-hsl07 + it_glfunct-hsl08 + it_glfunct-hsl09.
l_hslvt_c = l_hslvt - it_glfunct-hsl09.
l_hslvt_b = it_glfunct-hsl09.
when '10'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05 + it_glfunct-hsl06 +
it_glfunct-hsl07 + it_glfunct-hsl08 + it_glfunct-hsl09 +
it_glfunct-hsl10.
l_hslvt_c = l_hslvt - it_glfunct-hsl10.
l_hslvt_b = it_glfunct-hsl10.
when '11'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05 + it_glfunct-hsl06 +
it_glfunct-hsl07 + it_glfunct-hsl08 + it_glfunct-hsl09 +
it_glfunct-hsl10 + it_glfunct-hsl11.
l_hslvt_c = l_hslvt - it_glfunct-hsl11.
when '12'.
l_hslvt = it_glfunct-hsl01 + it_glfunct-hsl02 + it_glfunct-hsl03 +
it_glfunct-hsl04 + it_glfunct-hsl05 + it_glfunct-hsl06 +
it_glfunct-hsl07 + it_glfunct-hsl08 + it_glfunct-hsl09 +
it_glfunct-hsl10 + it_glfunct-hsl11 + it_glfunct-hsl12 +
it_glfunct-hsl13 + it_glfunct-hsl14 + it_glfunct-hsl15 +
it_glfunct-hsl16.
l_hslvt_c = l_hslvt - it_glfunct-hsl12 - it_glfunct-hsl13
- it_glfunct-hsl14 - it_glfunct-hsl15 - it_glfunct-hsl16.
l_hslvt_b = it_glfunct-hsl12 + it_glfunct-hsl13 + it_glfunct-hsl14 +
it_glfunct-hsl15 + it_glfunct-hsl16.
when others.
endcase.
**本年累计借方/贷方
if it_glfunct-drcrk = 'S'.
it_itab-hslvt_qms = l_hslvt.
it_itab-hslvt_qcs = l_hslvt_c.
it_itab-hslvt_bqs = it_itab-hslvt_bqs + l_hslvt_b.
else.
l_hslvt = 0 - l_hslvt.
l_hslvt_c = 0 - l_hslvt_c.
l_hslvt_b = 0 - l_hslvt_b.
it_itab-hslvt_qmh = l_hslvt.
it_itab-hslvt_qch = l_hslvt_c.
it_itab-hslvt_bqh = it_itab-hslvt_bqh + l_hslvt_b.
endif.
**期末余额
* it_itab-hslvt_m = it_itab-hslvt_c + it_itab-hslvt_s - it_itab-hslvt_h.
**功能范围及其描述
it_itab-func_area = it_glfunct-rfarea.
read table it_tfkbt with key fkber = it_itab-func_area binary search.
if sy-subrc = 0.
it_itab-fkbtx = it_tfkbt-fkbtx.
endif.
concatenate it_itab-func_area it_itab-racct into it_itab-text01.
if it_itab-racct cp '6608*' .
if it_itab-fkbtx is not initial and it_itab-txt20 is not initial.
concatenate it_itab-fkbtx '_' it_itab-txt20 into it_itab-text02.
elseif it_itab-fkbtx is not initial and it_itab-txt20 is initial.
it_itab-text02 = it_itab-fkbtx.
elseif it_itab-fkbtx is initial and it_itab-txt20 is not initial.
it_itab-text02 = it_itab-txt20.
endif.
else.
it_itab-text02 = it_itab-txt20.
endif.
move-corresponding it_itab to lt_itab.
collect lt_itab.
clear:lt_itab,
it_itab-hslvt_qms,
it_itab-hslvt_qmh,
it_itab-hslvt_qch,
it_itab-hslvt_qcs,
it_itab-hslvt_bqs,
it_itab-hslvt_bqh,
it_itab-hslvt_m,
it_itab-fkbtx,it_itab-text01,it_itab-text02.
endloop.
endif.
clear:it_itab.
endloop.
clear:it_itab.
refresh:it_itab.
it_itab[] = lt_itab[].
clear:lt_itab.
refresh:lt_itab.
delete it_itab where hslvt_qms = 0
and hslvt_qmh = 0
and hslvt_qcs = 0
and hslvt_qch = 0
and hslvt_m = 0.
loop at it_itab ."WHERE racct NP '6608*'.
move-corresponding it_itab to it_display.
if it_itab-racct cp '6608*'.
append it_display.
else.
collect it_display.
endif.
endloop.
endform. " frm_process_data
*&---------------------------------------------------------------------*
*& Form FRM_OUTPUT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_output_data.
type-pools: slis,kkblo.
data: et_fieldcat type kkblo_t_fieldcat.
data: cs_kkblo_layout type kkblo_layout.
data: fieldcat type slis_t_fieldcat_alv with header line,
fieldcat_ln like line of fieldcat,
sortcat type slis_t_sortinfo_alv,
sortcat_ln like line of sortcat,
eventcat type slis_t_event,
eventcat_ln like line of eventcat.
eventcat_ln-name = slis_ev_top_of_page.
eventcat_ln-form = 'TOP_OF_PAGE'.
append eventcat_ln to eventcat.
clear eventcat_ln.
eventcat_ln-name = slis_ev_top_of_list.
eventcat_ln-form = 'TOP_OF_LIST'.
append eventcat_ln to eventcat.
data: gt_list_top_of_page type slis_t_listheader.
data : ps_layout type slis_layout_alv.
data: nn type i,
title type lvc_title,
len type i.
define hout1.
nn = nn + 1.
fieldcat-tabname = 'IT_DISPLAY'.
fieldcat-fieldname = '&1'.
fieldcat-seltext_m = &2.
fieldcat-col_pos = nn.
fieldcat-outputlen = &3.
fieldcat-datatype = '&4'.
fieldcat-do_sum = &5.
fieldcat-just = &6.
fieldcat-hotspot = &7.
fieldcat-lzero = 'X'.
append fieldcat.
clear fieldcat.
end-of-definition.
* MOVE '检验点数据查询报表' TO TITLE.
ps_layout-zebra = 'X'.
* ps_layout-colwidth_optimize = 'X'.
* hout1 year text-007 4 char '' '' ''.
* hout1 monat text-008 4 char '' '' ''.
* hout1 bukrs text-009 4 char '' '' ''.
* hout1 func_area text-010 16 char '' '' ''.
* hout1 fkbtx text-011 25 char '' '' ''.
* hout1 racct text-012 10 char '' '' 'X'.
* hout1 txt20 text-013 20 char '' '' ''.
* hout1 text01 text-018 26 char '' '' ''.
* hout1 text02 text-019 50 char '' '' ''.
hout1 saknr '科目号' 10 char '' '' ''.
hout1 text02 '科目描述' 50 char '' '' ''.
* hout1 hslvt_c text-014 17 curr '' 'R' ''.
hout1 hslvt_qcs '借方' 17 curr '' 'R' ''.
hout1 hslvt_qch '贷方' 17 curr '' 'R' ''.
hout1 hslvt_bqs '借方' 17 curr '' 'R' ''.
hout1 hslvt_bqh '贷方' 17 curr '' 'R' ''.
hout1 hslvt_qms text-015 17 curr '' 'R' ''.
hout1 hslvt_qmh text-016 17 curr '' 'R' ''.
* hout1 hslvt_m text-017 17 curr '' 'R' ''.
* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* IS_LAYOUT = PS_LAYOUT
* IT_FIELDCAT = FIELDCAT[]
* I_SAVE = 'A'
* IT_EVENTS = EVENTCAT
* I_GRID_TITLE = TITLE
* TABLES
* T_OUTTAB = IT_ITAB
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = ps_layout
it_fieldcat = fieldcat[]
it_events = eventcat
tables
t_outtab = it_display
exceptions
program_error = 1
others = 2.
endform. " FRM_OUTPUT_DATA
*&--------------------------------------------------------------------*
*& Form USER_COMMAND
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->R_UCOMM text
* -->SELFIELD text
*---------------------------------------------------------------------*
form user_command using r_ucomm like sy-ucomm
selfield type slis_selfield.
read table it_itab index selfield-tabindex.
check sy-subrc = 0.
if r_ucomm eq '&IC1'.
case selfield-sel_tab_field.
when 'IT_ITAB-RACCT'.
set parameter id 'SAK' field it_itab-racct.
set parameter id 'BUK' field it_itab-bukrs.
set parameter id 'GJR' field it_itab-year.
call transaction 'FS10N' and skip first screen.
when others.
endcase.
endif.
endform. "USER_COMMAND
*&---------------------------------------------------------------------*
*& Form frm_authority_check
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_authority_check.
data: l_subrc type i.
call function 'ZGLBP_0_AUTHORITY_CHECK'
exporting
z_tcode = sy-tcode
importing
z_subrc = l_subrc.
if l_subrc = 4.
message '您没有使用该程序的权限!' type 'I'.
endif.
endform. " frm_authority_check
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form top_of_page.
*-To display the headers for main list
format color col_heading.
write: / sy-uline(210).
write: / sy-vline,
(59) '科目' centered,
sy-vline,
(33) ' 期初余额' centered ,
sy-vline,
(33) ' 本期发生' centered,
sy-vline,
(33) '期末余额' centered,
sy-vline.
format color off.
endform. "top_of_page
*&---------------------------------------------------------------------*
*& Form TOP_OF_LIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form top_of_list.
data: l_year_month type string.
* CONCATENATE sy-datum+0(4) '年' p_monat+4(2) '月' INTO l_year_month.
concatenate p_monat+0(4) '年' p_monat+4(2) '月' into l_year_month.
write: /70(16) '汇总式总账' centered.
write: /70(16) l_year_month centered.
skip.
endform. "TOP_OF_LIST
浙公网安备 33010602011771号