1、主程序单元
************************************************************************
* Copyright 2003 *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project :SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on :
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
include zfie0032top."全局变量说明但愿
include zfie0032o01."输出Module说明单元
include zfie0032i01."输入Module说明单元
include zfie0032f01."共用函数说明单元
include zfie0032fi1."输入函数说明单元
include zfie0032fi2."输入函数说明单元
include zfie0032h01."输入帮助说明单元
2、 zfie0032top单元
************************************************************************
* Copyright 2003 *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project :SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on :
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
report zfie0030 message-id zdev.
constants: con_show(6) value 'SHOW',
con_change(6) value 'CHANGE'.
class cl_gui_cfw definition load.
tables: zfi017v,*zfi017v,bseg,setheadert,zfi010,zfi017,csku,cskt. "
*公司,年份,次数的新旧值
data: v_bukrs like zfi017-bukrs,
v_gjahr like zfi017-gjahr,
v_zmon like zfi017-zmon,
v_oldbukrs like zfi017-bukrs,
v_oldgjahr like zfi017-gjahr,
v_oldzmon like zfi017-zmon.
*grid的控件
controls: tctrl_order type tableview using screen '0100'.
data: col type cxtab_column.
* Table for all entries loaded from database
data: begin of order_extract occurs 0100.
include structure zfi017v.
include structure vimflagtab.
data: end of order_extract.
* Table for entries selected to show on screen
data: begin of order_total occurs 10.
include structure zfi017v.
include structure vimflagtab.
data: end of order_total.
*记录数据的状态信息的变量定义
data: begin of status_order. "state vector
include structure vimstatus.
data: end of status_order.
data: grid_item type i.
data: answer(1) type c,
actionmode(6),
datastate(1),
mark_total type i,
init(1),
first_flag(1).
data: wa_zfi017v type zfi017v.
data: ok_code like sy-ucomm,
save_ok like sy-ucomm. "OK-Code
data g_return_code type i.
data: vim_marked(1) type c. "mark-checkbox field
*存储屏幕选择的字段名
data indexfldname(30).
data: gt_fieldcatalog type lvc_t_fcat,
text(70).
**********************************************************
*用于帮助的变量说明
*屏幕字段的帮助函数使用的变量
*用于成本要素组的属于帮助
data: begin of i_zfi010 occurs 0,
name like zfi010-name,
end of i_zfi010.
*用于成本中心的输入帮助
data: begin of i_setheadert occurs 0,
ktext like cskt-ktext,
end of i_setheadert.
data: butxt like t001-bukrs.
data: ktext like cskt-kostl.
data: name like zfi010-name.
*用于输入帮助,存储帮助函数的通讯内表
data: begin of fldtab occurs 2.
include structure help_value.
data: end of fldtab.
data: f4dyn like sy-dynnr.
data: begin of f4hlp occurs 1.
include structure dynpread.
data: end of f4hlp.
3、ZFIE0032O01单元
************************************************************************
* Copyright 2003 C-Bons Wuhan *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project : SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on :
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
************************************************************************
*&Form Name : init_data
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*根据用户输入条件的变化,进行数据读取
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module init_data output.
if first_flag eq space.
first_flag = 'X'.
v_gjahr = sy-datum+0(4).
bseg-pswsl = 2.
endif.
if ( v_oldgjahr ne v_gjahr or v_oldbukrs ne v_bukrs and
v_oldzmon ne v_zmon ) and
v_gjahr ne space and v_bukrs ne space and v_zmon ne space.
perform fill_data.
else.
* SET CURSOR FIELD f LINE lin OFFSET o.
endif.
endmodule. " init_data OUTPUT
************************************************************************
*&Form Name : init_pbo
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*设置标题栏和工具条按钮
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module init_pbo output.
set pf-status 'MAIN100'.
set titlebar 'MAINTITLE'.
endmodule. " PBO OUTPUT
************************************************************************
*&Form Name :liste_show_liste
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*将显示数据写到显示字段中,并设置主键字段是否可输入
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module liste_show_liste output.
if tctrl_order-current_line gt tctrl_order-lines.
exit from step-loop.
endif.
grid_item = sy-loopc.
zfi017v-kostl = order_extract-kostl.
zfi017v-ktext = order_extract-ktext.
zfi017v-kstar = order_extract-kstar.
zfi017v-descript = order_extract-descript.
zfi017v-adamt = order_extract-adamt.
zfi017v-reasn = order_extract-reasn.
zfi017v-zyearmonth = order_extract-zyearmonth.
vim_marked = order_extract-mark.
loop at screen.
if ( order_extract-action = 'L'
and screen-name = 'VIM_MARKED' ).
screen-input = 0.
modify screen.
endif.
if ( zfi017v-kostl ne space
and screen-name = 'ZFI017V-KOSTL' ) or
( zfi017v-kstar ne space
and screen-name = 'ZFI017V-KSTAR' ) .
screen-input = 0.
modify screen.
endif.
endloop.
if vim_marked = 'M'.
vim_marked = 'X'.
endif.
endmodule. " LISTE_SHOW_LISTE OUTPUT
************************************************************************
*&Form Name : fill_data
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*根据用户输入读取数据并初试化状态变量
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form fill_data .
select *
into corresponding fields of order_extract
from zfi017
where zfi017~bukrs = v_bukrs
and zfi017~gjahr = v_gjahr
and zfi017~zmon = v_zmon.
select single cskt~ktext as descript
into (order_extract-descript)
from cskt
where spras = '1'
and kokrs = '1000'
and kostl = order_extract-kostl.
select single ktext
into (order_extract-ktext)
from csku
where spras = '1' and ktopl ='CB00'
and kstar = order_extract-kstar.
append order_extract.
endselect.
sort order_extract by bukrs gjahr kostl kstar.
* order_extract[] = order_total[].
if actionmode = con_change.
perform insert_newworkarea using grid_item.
endif.
describe table order_extract lines tctrl_order-lines.
tctrl_order-top_line = 1.
clear ok_code.
mark_total = 1.
clear:datastate,status_order.
v_oldgjahr = v_gjahr.
v_oldbukrs = v_bukrs.
endform. " fill_data
************************************************************************
*&Form Name : init_ctrl
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*根据数据状态,设置屏幕字段是否可以输入
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module init_ctrl output.
if actionmode eq space.
actionmode = con_show.
endif.
if con_show eq actionmode.
loop at screen.
case screen-name.
when 'V_BUKRS'.
screen-input = 1.
modify screen.
when 'V_GJAHR'.
screen-input = 1.
modify screen.
when 'V_ZMON'.
screen-input = 1.
modify screen.
endcase.
endloop.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-KOSTL'.
if sy-subrc = 0.
col-screen-input = '0'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-KSTAR'.
if sy-subrc = 0.
col-screen-input = '0'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-ADAMT'.
if sy-subrc = 0.
col-screen-input = '0'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-REASN'.
if sy-subrc = 0.
col-screen-input = '0'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-ZYEARMONTH'.
if sy-subrc = 0.
col-screen-input = '0'.
modify tctrl_order-cols index sy-tabix from col.
endif.
else.
loop at screen.
case screen-name.
when 'V_BUKRS'.
screen-input = 0.
modify screen.
when 'V_GJAHR'.
screen-input = 0.
modify screen.
when 'V_ZMON'.
screen-input = 0.
modify screen.
endcase.
endloop.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-KOSTL'.
if sy-subrc = 0.
col-screen-input = '1'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-KSTAR'.
if sy-subrc = 0.
col-screen-input = '1'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-ADAMT'.
if sy-subrc = 0.
col-screen-input = '1'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-REASN'.
if sy-subrc = 0.
col-screen-input = '1'.
modify tctrl_order-cols index sy-tabix from col.
endif.
read table tctrl_order-cols into col
with key screen-name = 'ZFI017V-ZYEARMONTH'.
if sy-subrc = 0.
col-screen-input = '1'.
modify tctrl_order-cols index sy-tabix from col.
endif.
endif.
endmodule. " init_ctrl OUTPUT
4、ZFIE0032I01单元
************************************************************************
* Copyright 2003 *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project : SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on : *
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
************************************************************************
*&Form Name : LISTE_EXIT_COMMAND
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*处理系统退出命令,提示用户是否保存数据
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module liste_exit_command input.
data: savestate type i .
case ok_code.
when 'CANC'.
set screen 0.
leave screen.
when 'BACK'.
if datastate = 'X'.
call function 'POPUP_TO_CONFIRM_STEP'
exporting
titel = '退出维护'
textline1 = '数据被修改。'
textline2 = '是否先保存所做更改?'
importing
answer = answer.
case answer.
when 'J'.
perform save_data changing savestate.
sy-subrc = savestate.
when 'n'.
sy-subrc = 1.
when 'A'.
sy-subrc = 0.
endcase.
endif.
if sy-subrc = 0.
set screen 0.
leave screen.
endif.
when 'EXIT'.
if datastate = 'X'.
call function 'POPUP_TO_CONFIRM_STEP'
exporting
titel = '退出维护'
textline1 = '数据被修改。'
textline2 = '是否先保存所做更改?'
importing
answer = answer.
case answer.
when 'J'.
perform save_data changing savestate.
sy-subrc = savestate.
when 'n'.
sy-subrc = 1.
when 'A'.
sy-subrc = 0.
endcase.
endif.
if sy-subrc = 0.
set screen 0.
leave screen.
perform exit_program.
endif.
endcase.
endmodule. " LISTE_EXIT_COMMAND INPUT
**&---------------------------------------------------------------------
*
**& Module LISTE_BEFORE_LOOP INPUT
**&---------------------------------------------------------------------
*
** text
**----------------------------------------------------------------------
*
*MODULE liste_before_loop INPUT.
*
*ENDMODULE. " LISTE_BEFORE_LOOP INPUT
************************************************************************
*&Form Name : do_mark_checkbox
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*处理记录选中标记字段
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module liste_mark_checkbox input.
if status_order-upd_flag eq space. "only mouse mark
perform update_entry using space 0 tctrl_order-top_line.
endif.
endmodule. " LISTE_MARK_CHECKBOX INPUT
************************************************************************
*&Form Name : set_update_orderkey_flag
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*标记数据被修改,标记关键有新值需要检查
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module set_update_orderkey_flag input.
status_order-upd_flag = 'X'.
status_order-auth_check = 'X'.
status_order-st_data = 'X'.
datastate = 'X'.
endmodule. " set_update_orderkey_flag INPUT
************************************************************************
*&Form Name : set_update_orderkey_group
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*标记数据被修改,标记关键有新值需要检查
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module set_update_orderkey_group input.
status_order-upd_flag = 'X'.
status_order-auth_check = 'X'.
status_order-st_mode = 'X'.
datastate = 'X'.
endmodule. " set_update_orderkey_flag INPUT
************************************************************************
*&Form Name : set_update_order_flag
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*标记数据被修改
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module set_update_order_flag input.
status_order-upd_flag = 'X'.
datastate = 'X'.
endmodule. " SET_UPDATE_FLAG INPUT
************************************************************************
*&Form Name : liste_update_order
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*将工作区数据更新到显示和缓冲内表中
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module liste_update_order input.
if status_order-upd_flag = 'X'.
perform check_key_order.
perform update_tab_order using sy-subrc sy-tabix.
clear status_order.
endif.
endmodule. " LISTE_UPDATE_LISTE INPUT
************************************************************************
*&Form Name : check_key_order
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*关键字检查,判断是否重复
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form check_key_order .
* CLEAR order_total.
* READ TABLE order_total WITH KEY
* kostl = zfi017v-kostl
* KSTAR = zfi017v-KSTAR BINARY SEARCH.
* CHECK sy-subrc EQ 0.
* IF status_order-auth_check = 'X'.
* IF order_total-action EQ 'D'
* OR order_total-action EQ 'X'
* OR order_total-action EQ 'Y'.
* MESSAGE ID 'SV' TYPE 'E' NUMBER '010'.
* ELSE.
* MESSAGE ID 'SV' TYPE 'E' NUMBER '009'.
* ENDIF.
* ENDIF.
endform. "check_key_order
************************************************************************
*&Form Name : liste_after_loop
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*处理用户操作
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module liste_after_loop input.
* DATA: savestate TYPE i.
save_ok = ok_code.
clear ok_code.
case save_ok.
when 'EXIT' or 'BACK' or 'CANC'.
if datastate = 'C'.
call function 'POPUP_TO_CONFIRM_STEP'
exporting
titel = '退出维护'
textline1 = '数据被修改。'
textline2 = '是否先保存所做更改?'
importing
answer = answer.
case answer.
when 'J'.
perform save_data changing savestate.
sy-subrc = savestate.
when 'n'.
sy-subrc = 1.
when 'A'.
sy-subrc = 0.
endcase.
endif.
if sy-subrc = 0.
set screen 0.
leave screen.
perform exit_program.
endif.
when 'EDIT'.
if datastate eq space.
if con_show eq actionmode.
call function 'ENQUEUE_EZFIE017'
exporting
bukrs = v_bukrs
gjahr = v_gjahr
zmon = v_zmon
exceptions
foreign_lock = 2
system_failure = 3.
if sy-subrc ne 0.
message i622 with v_bukrs v_gjahr sy-msgv1.
else.
actionmode = con_change.
if ( v_oldgjahr = v_gjahr and v_oldbukrs = v_bukrs
and v_gjahr ne space and v_bukrs ne space ).
perform insert_newworkarea using grid_item.
endif.
endif.
endif.
endif.
when 'DELE'.
if con_show ne actionmode.
perform delete_order.
endif.
when 'SAVE' or 'SAVV'.
if datastate ne space.
perform save_data changing savestate.
if savestate eq 0.
call function 'DEQUEUE_EZFIE017'
exporting
bukrs = v_bukrs
gjahr = v_gjahr
zmon = v_zmon.
clear datastate.
endif.
else.
call function 'DEQUEUE_EZFIE017'
exporting
bukrs = v_bukrs
gjahr = v_gjahr
zmon = v_zmon.
perform clear_action.
endif.
when 'SOUP'.
* search for selected columns.
loop at tctrl_order-cols into col.
if col-selected = 'X'.
indexfldname = col-screen-name+11.
sort order_total by (indexfldname).
exit.
endif.
endloop.
when 'SODO'.
loop at tctrl_order-cols into col.
if col-selected = 'X'.
indexfldname = col-screen-name+11.
sort order_total by (indexfldname) descending.
exit.
endif.
endloop.
when others.
call method cl_gui_cfw=>dispatch.
endcase.
call method cl_gui_cfw=>flush.
endmodule. " LISTE_AFTER_LOOP INPUT
************************************************************************
*&Form Name : insert_newworkarea
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*为编辑数据添加临时空记录
*----------------------------------------------------------------------*
*参数说明
*-->p_entries:插入新空白记录数
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form insert_newworkarea using p_entries.
if p_entries eq 0.
p_entries = 20.
endif.
clear order_extract.
move 'L' to order_extract-action.
do p_entries times.
append order_extract.
enddo.
move tctrl_order-lines to tctrl_order-top_line.
describe table order_extract lines tctrl_order-lines.
endform. " insert_newworkarea
************************************************************************
*&Form Name : delete_order
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*删除的数据,在缓冲数据中设立删除标志(只能删除新建且未保存的定价)
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
* *
************************************************************************
*----------------------------------------------------------------------*
form delete_order .
loop at order_extract.
if order_extract-mark = 'M' and
order_extract-action ne 'L'.
delete order_extract.
endif.
endloop.
describe table order_extract lines tctrl_order-lines.
endform. " delete_order
5、ZFIE0032F01单元
************************************************************************
* Copyright 2003 Wuhan *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project : SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on : *
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
************************************************************************
*&Form Name : exit_program
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*退出程序时, 解除锁
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form exit_program.
call function 'DEQUEUE_EZFIE017'
exporting
bukrs = v_bukrs
gjahr = v_gjahr
znum = v_zmon.
leave program.
endform. " exit_program
6、ZFIE0032FI1单元
************************************************************************
* Copyright 2003 *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project : SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on : *
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
************************************************************************
*&Form Name : clear_action
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*清除数据操作状态,恢复到初试显示状态
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form clear_action.
* order_extract[] = order_total[].
actionmode = con_show.
describe table order_extract lines tctrl_order-lines.
tctrl_order-top_line = 1.
clear ok_code.
mark_total = 1.
clear:datastate,status_order.
clear status_order.
endform. " clear_action
************************************************************************
*&Form Name : clear_mark
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*清除记录选中标记
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form clear_mark .
loop at order_total.
order_total-mark = space.
modify order_total index sy-tabix.
endloop.
endform. " clear_mark
************************************************************************
*&Form Name : save_data
* Created by : DEV01 *
* Created on :
*----------------------------------------------------------------------*
* Function Description: *
*保存数据
*----------------------------------------------------------------------*
*参数说明
*<--savestate:返回保存是否成功,成功为0值
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form save_data changing savestate type i.
data i_znum type i.
savestate = -1.
delete from zfi017
where bukrs = v_bukrs and
gjahr = v_gjahr and
zmon = v_zmon.
i_znum = 1.
loop at order_extract.
if order_extract-action eq space.
zfi017-bukrs = order_extract-bukrs.
zfi017-gjahr = order_extract-gjahr.
zfi017-zmon = order_extract-zmon.
zfi017-znum = i_znum.
zfi017-kostl = order_extract-kostl.
zfi017-kstar = order_extract-kstar.
zfi017-adamt = order_extract-adamt.
zfi017-reasn = order_extract-reasn.
zfi017-zyearmonth = order_extract-zyearmonth.
insert zfi017.
if sy-subrc ne 0.
rollback work.
exit.
endif.
i_znum = i_znum + 1.
elseif order_extract-action = 'U'.
zfi017-bukrs = order_extract-bukrs.
zfi017-gjahr = order_extract-gjahr.
zfi017-zmon = order_extract-zmon.
zfi017-znum = i_znum.
zfi017-kostl = order_extract-kostl.
zfi017-kstar = order_extract-kstar.
zfi017-adamt = order_extract-adamt.
zfi017-reasn = order_extract-reasn.
zfi017-zyearmonth = order_extract-zyearmonth.
insert zfi017.
if sy-subrc ne 0.
rollback work.
exit.
endif.
i_znum = i_znum + 1.
order_total-action = space.
modify order_extract.
elseif order_extract-action = 'X'.
delete order_total.
elseif ( ( order_extract-action = 'D' ) or
( order_extract-action = 'Y' ) ).
delete order_extract.
elseif order_extract-action = 'N'.
zfi017-bukrs = order_extract-bukrs.
zfi017-gjahr = order_extract-gjahr.
zfi017-zmon = order_extract-zmon.
zfi017-znum = i_znum.
zfi017-kostl = order_extract-kostl.
zfi017-kstar = order_extract-kstar.
zfi017-adamt = order_extract-adamt.
zfi017-reasn = order_extract-reasn.
zfi017-zyearmonth = order_extract-zyearmonth.
insert zfi017.
if sy-subrc ne 0.
rollback work.
exit.
endif.
i_znum = i_znum + 1.
order_total-action = space.
modify order_extract.
endif.
7、ZFIE0032FI2单元
************************************************************************
* Copyright 2003 *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project : SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on : *
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
************************************************************************
*&Form Name : update_tab_order
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*将显示缓冲work area的数据更新到内表
*----------------------------------------------------------------------*
*参数说明 *
* --> p_rc :记录定位操作返回的sy-subrc的值
* --> p_index :记录的索引位置
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form update_tab_order using value(p_rc)
value(p_index).
perform update_entry using 'X' p_rc p_index.
endform. " update_tab
************************************************************************
*&Form Name : update_tab_order
* Created by : DEV01 *
* Created on :*
*----------------------------------------------------------------------*
* Function Description: *
*将显示缓冲work area的数据更新到内表
*----------------------------------------------------------------------*
*参数说明
* --> p_workarea : ‘X' 更新显示和缓冲双份内表数据
* space 只更新显示内表数据
* --> p_rc :记录定位操作返回的sy-subrc的值
* --> p_index :记录的索引位置
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
form update_entry using value(p_workarea)
value(p_rc)
value(p_index).
read table order_extract index tctrl_order-top_line.
if order_extract-action = 'L'.
move-corresponding zfi017v to order_extract.
order_extract-bukrs = v_bukrs.
order_extract-gjahr = v_gjahr.
order_extract-zmon = v_zmon.
order_extract-action = 'N'.
if vim_marked ne space.
order_extract-mark = 'M'.
endif.
modify order_extract index tctrl_order-top_line.
clear order_extract.
order_extract-action = 'L'.
append order_extract.
else.
move-corresponding zfi017v to order_extract.
order_extract-bukrs = v_bukrs.
order_extract-gjahr = v_gjahr.
order_extract-zmon = v_zmon.
order_extract-action = 'U'.
if vim_marked ne space.
order_extract-mark = 'M'.
endif.
modify order_extract index tctrl_order-top_line.
endif.
describe table order_extract lines tctrl_order-lines.
endform. "update_tab_order
endloop.
commit work.
savestate = 0.
perform clear_action.
message s024.
endform. " save_data
8、ZFIE0032H01单元
************************************************************************
* Copyright 2003 Wuhan *
* All Rights Reserved *
*----------------------------------------------------------------------*
* Program Name : ZFIE0005 *
* TYPE : REPORT *
* Project : SAP Implementation Project *
* Program Title: 管理部门年度预算考核额调整
* Created by : DEV01 *
* Created on : *
* Version : 1.0 *
* Function Description: *
* 管理部门年度预算考核额调整
*----------------------------------------------------------------------*
*操作数据表
*ZFI017
*----------------------------------------------------------------------*
*引用数据表
*
*----------------------------------------------------------------------*
* Modification Log: *
* Date Programmer Correction Number DesingDoc Number *
************************************************************************
************************************************************************
*&Form Name : v_bukrs_check
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*公司代码字段输入检查:不能为空且代码不能不存在
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module v_bukrs_check input.
tables: t001.
if v_bukrs = space.
message e023 with '公司代码'.
endif.
select single * from t001 where bukrs = v_bukrs.
if sy-subrc ne 0.
message e014 with v_bukrs.
endif.
endmodule. " v_bukrs_check INPUT
************************************************************************
*&Form Name : v_gjahr_check
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*年份代码字段输入检查:不能为空且年份不能小于1990
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module v_gjahr_check input.
if v_gjahr = space.
message e023 with '年份'.
endif.
if v_gjahr gt 9999 or v_gjahr lt 1000.
message e046.
endif.
endmodule. " v_gjahr_check INPUT
************************************************************************
*&Form Name : v_zmon_check
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*月份字段输入检查
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module v_zmon_check input.
if v_zmon = space.
message e023 with '月份'.
endif.
if v_zmon gt 12 or v_zmon lt 1.
message e047.
endif.
endmodule. " v_gjahr_check INPUT
************************************************************************
*&Form Name : select_kostl
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*获取成本中心组(帮助输入)
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module select_kostl input.
data:
dynpro_values type table of dynpread,
field_value like line of dynpro_values,
l_year like bkpf-gjahr,
g_kh(10).
data: begin of i_tree occurs 0,
setname like setnode-setname,
end of i_tree.
data: i_subtree like i_tree occurs 0 with header line,
i_temptree like i_tree occurs 0 with header line.
data l_count type i .
ranges: s_setname for setnode-setname.
ranges: s_kostl for cskt-kostl.
refresh dynpro_values.
field_value-fieldname = 'V_GJAHR'.
append field_value to dynpro_values.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-repid
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = dynpro_values.
read table dynpro_values index 1 into field_value.
l_year = field_value-fieldvalue(4).
refresh i_setheadert.
s_setname-option = 'EQ'.
s_setname-sign = 'I'.
l_count = 1.
refresh i_temptree.
refresh i_subtree.
*特殊处理,2005年预算用2006的机构
if l_year < 2006.
l_year = 2006.
endif.
concatenate 'KH' l_year into g_kh.
while l_count > 0.
select setnode~subsetname as setname
into (setheadert-setname)
from setnode
where setnode~setclass = '0101'
and setnode~subclass = '1000'
and setnode~subsetcls = '0101'
and setnode~subsetscls = '1000'
and setnode~setname = g_kh.
move setheadert-setname to s_setname-low.
append s_setname.
i_temptree-setname = setheadert-setname.
append i_temptree.
endselect.
append lines of i_temptree to i_subtree.
describe table i_subtree lines l_count.
if l_count ne 0.
read table i_subtree index 1.
g_kh = i_subtree-setname.
delete i_subtree index 1.
endif.
refresh i_temptree.
clear i_temptree.
endwhile.
select valsign as sign valoption as option
valfrom as low valto as high
into table s_kostl
from setleaf
where setclass = '0101'
and subclass = '1000' and setname in s_setname.
refresh i_setheadert.
select single bukrs from t001 into butxt
where bukrs = v_bukrs.
if sy-subrc <> 0.
message id 'ZDEV' type 'S' number '049'.
exit.
endif.
select cskt~kostl cskt~ktext
into (cskt-kostl,cskt-ktext)
from cskt
where spras = '1'
and kokrs = '1000'
and kostl in s_kostl.
move cskt-kostl to i_setheadert-ktext.
append i_setheadert.
move cskt-ktext to i_setheadert-ktext.
append i_setheadert.
endselect.
refresh fldtab.
clear fldtab.
fldtab-tabname = 'CSKT'.
fldtab-fieldname = 'KOSTL'.
fldtab-selectflag = 'X'.
append fldtab.
clear fldtab.
fldtab-tabname = 'CSKT'.
fldtab-fieldname = 'KTEXT'.
append fldtab.
call function 'HELP_VALUES_GET_WITH_TABLE'
exporting
display = space
fieldname = 'KOSTL'
tabname = 'ZFI017V'
importing
select_value = ktext
tables
fields = fldtab
valuetab = i_setheadert.
if not ktext is initial.
zfi017v-kostl = ktext.
endif.
endmodule. " select_kostl INPUT
************************************************************************
*&Form Name : select_zgroup
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*获取某个年度成本要素组(帮助输入)
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module select_zgroup input.
refresh i_zfi010.
*********XIONGHM***************
select kstar ktext
into (csku-kstar,csku-ktext)
from csku
where spras = '1' and ktopl ='CB00'.
i_zfi010-name = csku-kstar.
append i_zfi010.
i_zfi010-name = csku-ktext.
append i_zfi010.
endselect.
refresh fldtab.
clear fldtab.
fldtab-tabname = 'ZFI017V'.
fldtab-fieldname = 'KSTAR'.
fldtab-selectflag = 'X'.
append fldtab.
clear fldtab.
fldtab-tabname = 'ZFI017V'.
fldtab-fieldname = 'KTEXT'.
append fldtab.
call function 'HELP_VALUES_GET_WITH_TABLE'
exporting
display = space
fieldname = 'KSTAR'
tabname = 'ZFI017V'
importing
select_value = name
tables
fields = fldtab
valuetab = i_zfi010.
if not name is initial.
zfi017v-kstar = name.
endif.
endmodule. " select_prodh INPUT
************************************************************************
*&Form Name : v_check_kostl
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*检查成本输入中心是否存在
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module v_check_kostl input.
if zfi017v-kostl eq space.
message e621 with zfi017v-kostl.
endif.
if status_order-st_data ne space.
select single ktext as descript
into zfi017v-descript
from cskt
where spras = '1'
and kokrs = '1000'
and kostl = zfi017v-kostl.
if sy-subrc ne 0.
message e620 with zfi017v-kostl.
endif.
endif.
endmodule. " v_check_kostl INPUT
************************************************************************
*&Form Name : v_check_zgroup
* Created by : DEV01 *
* Created on : *
*----------------------------------------------------------------------*
* Function Description: *
*检查输入成本要素组是否存在
*----------------------------------------------------------------------*
*参数说明
*
*----------------------------------------------------------------------*
* Date Programmer Description *
************************************************************************
module v_check_zgroup input.
if zfi017v-kstar eq space.
message e621 with zfi017v-kstar.
endif.
if status_order-st_mode ne space.
select single ktext
into (zfi017v-ktext)
from csku
where spras = '1' and ktopl ='CB00'
and kstar = zfi017v-kstar.
if sy-subrc ne 0.
message e621 with zfi017v-kstar.
endif.
endif.
endmodule. " v_check_zgroup INPUT
9、屏幕PBO和PAI
*BEFORE OUTPUT
process before output.
module init_pbo.
module init_data.
module init_ctrl.
loop at order_extract with control tctrl_order
cursor tctrl_order-top_line.
module liste_show_liste.
endloop.
*After input
process after input.
module liste_exit_command at exit-command.
field v_bukrs module v_bukrs_check on request.
field v_gjahr module v_gjahr_check on request.
field v_zmon module v_zmon_check on request.
module liste_before_loop.
loop at order_extract.
field zfi017v-kostl
module set_update_orderkey_flag on request.
field zfi017v-kstar
module set_update_orderkey_group on request.
chain.
field zfi017v-adamt.
field zfi017v-reasn.
field zfi017v-zyearmonth.
module set_update_order_flag on chain-request.
endchain.
field vim_marked module liste_mark_checkbox.
**检查
field zfi017v-kostl module v_check_kostl.
field zfi017v-kstar module v_check_zgroup.
* save current data to order_total
chain.
field zfi017v-kostl.
field zfi017v-kstar.
field zfi017v-adamt.
field zfi017v-reasn.
field zfi017v-zyearmonth.
module liste_update_order.
endchain.
endloop.
*deal with function Code
module liste_after_loop.
process on value-request.
field zfi017v-kostl module select_kostl.
field zfi017v-kstar module select_zgroup.