收藏 分享(赏)

FMBB预算下达增强.doc

上传人:tangtianxu2 文档编号:2857512 上传时间:2018-09-28 格式:DOC 页数:21 大小:387.60KB
下载 相关 举报
FMBB预算下达增强.doc_第1页
第1页 / 共21页
FMBB预算下达增强.doc_第2页
第2页 / 共21页
FMBB预算下达增强.doc_第3页
第3页 / 共21页
FMBB预算下达增强.doc_第4页
第4页 / 共21页
FMBB预算下达增强.doc_第5页
第5页 / 共21页
点击查看更多>>
资源描述

1、FMBB 预算下达控制直接创建实施代码:DATA: l_diff_years TYPE fmmaact-perc_time_hor,l_s_lines TYPE fmku_s_badi_line,l_s_fmci TYPE fmci,l_active_process_entry TYPE xflag,l_active_process_return TYPE xflag,l_active_process_suppl TYPE xflag,l_active_process_trans TYPE xflag,l_active_process_carryover TYPE xflag,l_s_addr

2、ess TYPE fmku_s_dimpart,l_t_address TYPE fmku_t_dimpart,l_t_fmbdt TYPE fmbd_t_t,l_s_fmbdt TYPE fmbdt,l_perc_time_hor TYPE fmmaact-perc_time_hor,l_budget_option TYPE fmmaact-ma_bud_option.DATA: l_s_msg TYPE bubas_s_msg.DATA: l_nd TYPE gjahr.* Read the budcat and fm areaLOOP AT i_t_lines INTO l_s_line

3、s FROM 1 TO 1.ENDLOOP.l_nd = l_s_lines-FISCYEAR.* Read multi-annual customizingCALL FUNCTION FMMA_CHECK_ACTIVATIONEXPORTINGi_fm_area = i_s_header-fm_areai_budcat = l_s_lines-budcatIMPORTINGe_perc_time_hor = l_perc_time_hore_budget_option = l_budget_optionEXCEPTIONSnot_active = 1OTHERS = 2.IF sy-subr

4、c 0.CLEAR l_s_fmci .ENDIF.IF l_s_fmci-ncbud IS NOT INITIAL.* Not multi-annual address: multi-annual entries are not allowedl_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_msg-msgno = 009.l_s_msg-msgv1 = l_s_lines-address-cmmtitem.* l_f_msg-CONTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_mess

5、ageEXPORTINGi_s_msg = l_s_msg.CLEAR l_s_msg.ELSE.CASE l_s_lines-process.WHEN ENTR.IF l_active_process_entry EQ X.l_diff_years = l_s_lines-ceffyear - l_nd .* If the l_diff_year is less than percentage time* horizon than raise the error* posting on this year of cash effectivity is not allowedIF NOT l_

6、diff_years GT l_perc_time_hor.l_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_msg-msgno = 008.l_s_msg-msgv1 = l_s_lines-ceffyear .* l_f_msg-CONTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.CLEAR l_s_msg.ENDIF.ENDIF.WHEN SUPL.IF l_active_process_suppl EQ X.l_d

7、iff_years = l_s_lines-ceffyear - l_nd .* If the l_diff_year is less than PTH than raise the error* posting on this year of cash effectivity is not allowedIF NOT l_diff_years GT l_perc_time_hor.l_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_msg-msgno = 008.l_s_msg-msgv1 = l_s_lines-ceffyear .* l_f_msg-CO

8、NTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.CLEAR l_s_msg.ENDIF.ENDIF.WHEN RETN.IF l_active_process_return EQ X.l_diff_years = l_s_lines-ceffyear - l_nd .* If the l_diff_year is less than PTH than raise the error* posting on this year of cash effectiv

9、ity is not allowedIF NOT l_diff_years GT l_perc_time_hor.l_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_msg-msgno = 008.l_s_msg-msgv1 = l_s_lines-ceffyear .* l_f_msg-CONTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.CLEAR l_s_msg.ENDIF.ENDIF.WHEN SEND.IF l_ac

10、tive_process_trans EQ X.l_diff_years = l_s_lines-ceffyear - l_nd .* If the l_diff_year is less than PTH than raise the error* posting on this year of cash effectivity is not allowedIF NOT l_diff_years GT l_perc_time_hor.l_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_msg-msgno = 008.l_s_msg-msgv1 = l_s_l

11、ines-ceffyear .* l_f_msg-CONTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.CLEAR l_s_msg.ENDIF.ENDIF.WHEN RECV.IF l_active_process_trans EQ X.l_diff_years = l_s_lines-ceffyear - l_nd .* If the l_diff_year is less than PTH than raise the error* posting on

12、this year of cash effectivity is not allowedIF NOT l_diff_years GT l_perc_time_hor.l_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_msg-msgno = 008.l_s_msg-msgv1 = l_s_lines-ceffyear .* l_f_msg-CONTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.CLEAR l_s_msg.END

13、IF.ENDIF.WHEN COSD.IF l_active_process_carryover EQ X.l_diff_years = l_s_lines-ceffyear - l_nd .* If the l_diff_year is less than PTH than raise the error* carry over from this year of cash effectivity is not allowedIF NOT l_diff_years GT l_perc_time_hor.l_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_ms

14、g-msgno = 010.l_s_msg-msgv1 = l_s_lines-ceffyear .* l_f_msg-CONTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.CLEAR l_s_msg.ENDIF.ENDIF.WHEN CORV.IF l_active_process_trans EQ X.l_diff_years = l_s_lines-ceffyear - l_nd .* If the l_diff_year is less than PT

15、H than raise the error* carry over to this year of cash effectivity is not allowedIF NOT l_diff_years GT l_perc_time_hor.l_s_msg-msgty = E.l_s_msg-msgid = FMMA.l_s_msg-msgno = 010.l_s_msg-msgv1 = l_s_lines-ceffyear .* l_f_msg-CONTEXT-AREA = con_msg_others.CALL METHOD i_ref_msg-cumulate_messageEXPORT

16、INGi_s_msg = l_s_msg.CLEAR l_s_msg.ENDIF.ENDIF.ENDCASE.ENDIF.ENDIF.ENDLOOP.ENDIF.IF i_t_lines IS NOT INITIAL.DATA:ls_znr TYPE zyspzb-znr.DATA:lv_date TYPE d.SELECT SINGLE znr FROM zyspzb INTO ls_znr WHERE zflag = F3 AND bukrs = 9999.IF ls_znr+0(1) CO 0123456789.CONCATENATE l_nd+0(4) ls_znr INTO lv_d

17、ate.CHECK l_nd lv_date.ENDIF.CLEAR:ls_znr.DATA:BEGIN OF ls_yszb2,bukrs TYPE zyszb-bukrs,gjahr TYPE zyszb-gjahr,fipex TYPE zyszb-fipex,zbb TYPE zyszb-zbb,fictr TYPE zyszb-fictr,zje TYPE zyszb-zje,zfipex TYPE zyszb-fipex,zbezei TYPE zyscncjb-zbezei,END OF ls_yszb2.DATA:lt_yszb2 LIKE TABLE OF ls_yszb2.

18、DATA:lt_zfipex TYPE TABLE OF zyscncjb.DATA:ls_zfipex LIKE LINE OF lt_zfipex.DATA:lt_zfipex1 TYPE TABLE OF zyscncjb.DATA:ls_zfipex1 LIKE LINE OF lt_zfipex1.DATA:lt_yszb TYPE TABLE OF zyszb.DATA:lt_yszb_temp TYPE TABLE OF zyszb.DATA:ls_yszb LIKE LINE OF lt_yszb.DATA:lt_yszb1 TYPE TABLE OF zyszb.DATA:l

19、s_yszb1 LIKE LINE OF lt_yszb.DATA:ls_yszb_temp LIKE LINE OF lt_yszb.DATA: ls_wlp TYPE tvalxx9.DATA: lv_mes1 TYPE string.DATA: lv_mes2 TYPE string.* data:BEGIN OF lt_FMBL,* FISCYEAR TYPE FMBL-FISCYEAR,* FUNDSCTR TYPE FMBL-FUNDSCTR,* CMMTITEM TYPE FMBL-CMMTITEM,* END OF lt_FMBL.DATA:lt_fmbl TYPE TABLE

20、 OF fmbl.DATA:lt_fmbl_temp TYPE TABLE OF fmbl.DATA:ls_fmbl LIKE LINE OF lt_fmbl.DATA:ls_fmbl_temp LIKE LINE OF lt_fmbl.DATA:lv_bukrs TYPE bukrs.DATA:lv_char5(5) TYPE c.CLEAR:l_s_lines,lv_char5,lv_bukrs.LOOP AT i_t_lines INTO l_s_lines. “获取公司代码IF lv_char5 IS INITIAL.lv_char5 = l_s_lines-address-funds

21、ctr+0(5).ELSE.IF lv_char5 cumulate_messageEXPORTINGi_s_msg = l_s_msg.ENDIF.ENDIF.ENDLOOP.CONCATENATE 57 lv_char5+3(2) into lv_bukrs.* lv_bukrs = lv_char5+1(4).*add by abap0320171108*Fmbb 下完预算后,校验,当年累计预算 +当前预算 =0. 否则提示报错,不允许下达负预算。CLEAR:lt_yszb,lt_yszb.LOOP AT i_t_lines INTO l_s_lines. “获取屏幕输入的预算金额ls_

22、yszb-fictr = l_s_lines-address-fundsctr.ls_yszb-fipex = l_s_lines-address-cmmtitem.DO 12 TIMES VARYING ls_wlp FROM l_s_lines-tval01 NEXT l_s_lines-tval02.ls_yszb-zje = ls_yszb-zje - ls_wlp.CLEAR:ls_wlp.ENDDO.COLLECT ls_yszb INTO lt_yszb.CLEAR:l_s_lines,ls_yszb.ENDLOOP.CLEAR:lt_fmbl.SELECT * “已消耗预算 0

23、0110501FROM fmblINTO TABLE lt_fmblFOR ALL ENTRIES IN lt_yszbWHERE fm_area = i_s_header-fm_areaAND docyear = l_nd+0(4)AND fundsctr = lt_yszb-fictrAND cmmtitem = lt_yszb-fipexAND budcat = 9FAND valtype = B1.CLEAR:lt_fmbl_temp,lt_fmbl_temp.LOOP AT lt_fmbl INTO ls_fmbl.ls_fmbl_temp-fundsctr = ls_fmbl-fu

24、ndsctr.ls_fmbl_temp-cmmtitem = ls_fmbl-cmmtitem.ls_fmbl_temp-tval01 = ls_fmbl-tval01.ls_fmbl_temp-tval02 = ls_fmbl-tval02.ls_fmbl_temp-tval03 = ls_fmbl-tval03.ls_fmbl_temp-tval04 = ls_fmbl-tval04.ls_fmbl_temp-tval05 = ls_fmbl-tval05.ls_fmbl_temp-tval06 = ls_fmbl-tval06.ls_fmbl_temp-tval07 = ls_fmbl-

25、tval07.ls_fmbl_temp-tval08 = ls_fmbl-tval08.ls_fmbl_temp-tval09 = ls_fmbl-tval09.ls_fmbl_temp-tval10 = ls_fmbl-tval10.ls_fmbl_temp-tval11 = ls_fmbl-tval11.ls_fmbl_temp-tval12 = ls_fmbl-tval12.ls_fmbl_temp-tval13 = ls_fmbl-tval13.ls_fmbl_temp-tval14 = ls_fmbl-tval14.ls_fmbl_temp-tval15 = ls_fmbl-tval

26、15.ls_fmbl_temp-tval16 = ls_fmbl-tval16.COLLECT ls_fmbl_temp INTO lt_fmbl_temp.CLEAR:ls_fmbl_temp,ls_fmbl.ENDLOOP.IF lt_fmbl_temp IS NOT INITIAL.LOOP AT lt_fmbl_temp INTO ls_fmbl. “将屏幕输入的预算金额 +已消耗预算金额READ TABLE lt_yszb INTO ls_yszb WITH KEY fictr = ls_fmbl-fundsctrfipex = ls_fmbl-cmmtitem.IF sy-subr

27、c = 0.DO 16 TIMES VARYING ls_wlp FROM ls_fmbl-tval01 NEXT ls_fmbl-tval02.ls_yszb-zje = ls_yszb-zje - ls_wlp.CLEAR:ls_wlp.ENDDO.IF ls_yszb-zje cumulate_messageEXPORTINGi_s_msg = l_s_msg.ENDIF.* MODIFY TABLE lt_yszb FROM ls_yszb TRANSPORTING ZJE.CLEAR:ls_yszb.ENDIF.ENDLOOP.ELSE.LOOP AT lt_yszb INTO ls

28、_yszb.IF ls_yszb-zje cumulate_messageEXPORTINGi_s_msg = l_s_msg.ENDIF.ENDLOOP.ENDIF.*add by abap0320171108SELECT SINGLE znr FROM zyspzb INTO ls_znr WHERE zflag = F2 AND bukrs = lv_bukrs.IF ls_znr lS_ZFIPEX1-FIPEX.ls_yszb1-fipex = ls_zfipex1-fipex.ls_yszb1-fictr = ls_yszb-fictr.IF ls_yszb-fictr = ls_

29、yszb1-fictr and ls_yszb-fipex = ls_yszb1-fipex.CONTINUE.ENDIF.APPEND ls_yszb1 TO lt_yszb1.CLEAR:ls_yszb1,ls_zfipex1.* ENDIF.ENDLOOP.CLEAR:ls_zfipex.ENDIF.CLEAR:ls_yszb.ENDLOOP.SORT lt_yszb1.DELETE ADJACENT DUPLICATES FROM lt_yszb1.CLEAR:lt_fmbl.SELECT * “已消耗预算 00110501FROM fmblINTO TABLE lt_fmblFOR

30、ALL ENTRIES IN lt_yszbWHERE fm_area = i_s_header-fm_areaAND docyear = l_nd+0(4)AND fundsctr = lt_yszb-fictrAND cmmtitem = lt_yszb-fipex.IF lt_yszb1 IS NOT INITIAL.SELECT * “已消耗预算00110502/00110503。 FROM fmblAPPENDING TABLE lt_fmblFOR ALL ENTRIES IN lt_yszb1WHERE fm_area = i_s_header-fm_areaAND docyea

31、r = l_nd+0(4)AND fundsctr = lt_yszb1-fictrAND cmmtitem = lt_yszb1-fipex.ENDIF.LOOP AT lt_fmbl INTO ls_fmbl. “将屏幕输入的预算金额 +已消耗预算金额READ TABLE lt_yszb INTO ls_yszb WITH KEY FICTR = ls_fmbl-FUNDSCTRFIPEX = ls_fmbl-CMMTITEM.IF SY-SUBRC = 0.DO 12 TIMES varying ls_wlp from ls_fmbl-TVAL01 next ls_fmbl-TVAL02

32、.ls_yszb-ZJE = ls_yszb-ZJE - ls_wlp.CLEAR:ls_wlp.ENDDO.MODIFY TABLE lt_yszb FROM ls_yszb TRANSPORTING ZJE.CLEAR:ls_yszb.ENDIF.READ TABLE lt_yszb1 INTO ls_yszb1 WITH KEY fictr = ls_fmbl-fundsctrfipex = ls_fmbl-cmmtitem.IF sy-subrc = 0.DO 12 TIMES VARYING ls_wlp FROM ls_fmbl-tval01 NEXT ls_fmbl-tval02

33、.ls_yszb1-zje = ls_yszb1-zje - ls_wlp.CLEAR:ls_wlp.ENDDO.MODIFY TABLE lt_yszb1 FROM ls_yszb1 TRANSPORTING zje.CLEAR:ls_yszb1.ENDIF.ENDLOOP.LOOP AT lt_yszb INTO ls_yszb. “把二级承诺项目金额向一级承诺项目中汇总READ TABLE lt_zfipex1 INTO ls_zfipex WITH KEY fipex = ls_yszb-fipex.IF sy-subrc = 0.ls_yszb2-fipex = ls_zfipex-

34、zfipex.ls_yszb2-fictr = ls_yszb-fictr.ls_yszb2-zje = ls_yszb2-zje + ls_yszb-zje.ls_yszb2-zbezei = ls_zfipex-zbezei.COLLECT ls_yszb2 INTO lt_yszb2.CLEAR:ls_yszb,ls_zfipex,ls_yszb2.ENDIF.ENDLOOP.LOOP AT lt_yszb1 INTO ls_yszb1. “把二级承诺项目金额向一级承诺项目中汇总READ TABLE lt_zfipex1 INTO ls_zfipex WITH KEY fipex = l

35、s_yszb1-fipex.IF sy-subrc = 0.ls_yszb2-fipex = ls_zfipex-zfipex.ls_yszb2-fictr = ls_yszb1-fictr.ls_yszb2-zje = ls_yszb2-zje + ls_yszb1-zje.ls_yszb2-zbezei = ls_zfipex-zbezei.COLLECT ls_yszb2 INTO lt_yszb2.CLEAR:ls_yszb1,ls_zfipex,ls_yszb2.ENDIF.ENDLOOP.SELECT fictr fipex zbb zjeFROM zyszbINTO CORRES

36、PONDING FIELDS OF TABLE lt_yszb_tempFOR ALL ENTRIES IN lt_yszb2WHERE bukrs = lv_bukrsAND gjahr = l_nd+0(4)AND fictr = lt_yszb2-fictrAND fipex = lt_yszb2-fipex.SORT lt_yszb_temp BY fictr fipex zbb DESCENDING.DELETE ADJACENT DUPLICATES FROM lt_yszb_temp.LOOP AT lt_yszb2 INTO ls_yszb2.READ TABLE lt_ysz

37、b_temp INTO ls_yszb_temp WITH KEY fictr = ls_yszb2-fictrfipex = ls_yszb2-fipex.IF sy-subrc = 0.CLEAR:ls_yszb.READ TABLE lt_yszb INTO ls_yszb WITH KEY fictr = ls_yszb2-fictrfipex = ls_yszb2-fipex.IF ls_yszb2-zje ls_yszb_temp-zje AND ls_yszb-zje = 0.CLEAR:lv_mes1,lv_mes2,l_s_msg.l_s_msg-msgno = 000.l_

38、s_msg-msgty = E.l_s_msg-msgID = OK.* CONCATENATE 基金中心: ls_yszb2-fictr 、承诺项目: ls_yszb2-fipex INTO lv_mes1.CONCATENATE 基金中心: ls_yszb2-fictr 、承诺项目: ls_yszb2-fipex ls_yszb2-zbezei INTO lv_mes1.l_s_msg-msgv1 = lv_mes1.l_s_msg-msgv2 = 超出年度预算,请检查.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s

39、_msg.ENDIF.ELSE.CLEAR:lv_mes1,lv_mes2,l_s_msg.l_s_msg-msgno = 000.l_s_msg-msgty = E.l_s_msg-msgid = OK.* CONCATENATE 基金中心: ls_yszb2-fictr 、承诺项目: ls_yszb2-fipex INTO lv_mes1.CONCATENATE 基金中心: ls_yszb2-fictr 、承诺项目: ls_yszb2-fipex ls_yszb2-zbezei INTO lv_mes1.l_s_msg-msgv1 = lv_mes1.l_s_msg-msgv2 = 没有下

40、达预算,请用 ZFIR089进行预算下达!.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.ENDIF.ENDLOOP.ELSEIF ls_znr = F. “分公司代码LOOP AT i_t_lines INTO l_s_lines.ls_yszb-FICTR = l_s_lines-ADDRESS-FUNDSCTR.ls_yszb-fipex = l_s_lines-address-cmmtitem.* DO 12 TIMES VARYING ls_wlp FROM l_s_lines-tval01 NEXT

41、 l_s_lines-tval02.* ls_yszb-zje = ls_yszb-zje - ls_wlp.* CLEAR:ls_wlp.* ENDDO.CLEAR ls_yszb-zje.COLLECT ls_yszb INTO lt_yszb.CLEAR:l_s_lines,ls_yszb.ENDLOOP.SELECT zfipex “获取上级承诺项目fipexFROM zyscncjbINTO CORRESPONDING FIELDS OF TABLE lt_zfipexFOR ALL ENTRIES IN lt_yszbWHERE gjahr = l_nd+0(4)AND fipex

42、 = lt_yszb-fipex.SORT lt_zfipex.DELETE ADJACENT DUPLICATES FROM lt_zfipex.IF lt_zfipex IS NOT INITIAL.SELECT zfipex “获取同级承诺项目fipexFROM zyscncjbINTO CORRESPONDING FIELDS OF TABLE lt_zfipex1FOR ALL ENTRIES IN lt_zfipexWHERE gjahr = l_nd+0(4)AND zfipex = lt_zfipex-zfipex.SORT lt_zfipex1.DELETE ADJACENT

43、 DUPLICATES FROM lt_zfipex1.ENDIF.LOOP AT lt_yszb INTO ls_yszb. “00110501READ TABLE lt_zfipex INTO ls_zfipex WITH KEY fipex = ls_yszb-fipex. “读到上级的承诺项目 001105IF sy-subrc = 0.LOOP AT lt_zfipex1 INTO ls_zfipex1 WHERE zfipex = ls_zfipex-zfipex. “把同级的承诺项目 00110502/00110503加入到内表 lT_yszb1中* IF ls_yszb-FIP

44、EX ls_yszb_temp-zje AND ls_yszb-zje = 0.CLEAR:lv_mes1,lv_mes2,l_s_msg.l_s_msg-msgno = 000.l_s_msg-msgty = E.l_s_msg-msgid = OK.CONCATENATE 承诺项目: ls_yszb2-fipex ls_yszb2-zbezei INTO lv_mes1.l_s_msg-msgv1 = lv_mes1.l_s_msg-msgv2 = 超出年度预算,请检查.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s

45、_msg.ENDIF.CLEAR:ls_yszb_temp.ELSE.CLEAR:lv_mes1,lv_mes2,l_s_msg.l_s_msg-msgno = 000.l_s_msg-msgty = E.l_s_msg-msgid = OK.CONCATENATE 基金中心: ls_yszb2-fictr 、承诺项目: ls_yszb2-fipex ls_yszb2-zbezei INTO lv_mes1.l_s_msg-msgv1 = lv_mes1.l_s_msg-msgv2 = 没有下达预算,请用 ZFIR089进行预算下达!.CALL METHOD i_ref_msg-cumulate_messageEXPORTINGi_s_msg = l_s_msg.ENDIF.CLEAR:ls_yszb2.ENDLOOP.ENDIF.ENDIF.ENDIF.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 专业基础教材

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报