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