1.F110 删除操作的增强:
方法:SE19 ZE_F110_DELETE_CHECK
代码:
ENHANCEMENT 1 ZE_F110_DELETE_CHECK. "active version
**ZE_F110_DELETE_CHECK add by xiangc on 20170506 for F110 付款建议删除前的检查,建议ID在审核状态不允许删除.
**require by fi_luotang
DATA:LS_ZTYJ_FK_STATUS TYPE ZTYJ_FK_STATUS.
DATA:lv_answer TYPE c.
CASE OK-CODE.
*------- Zahlungsaufträge löschen --------------------------------------
* WHEN 'PYOD'.
* SUBMIT RFPYORDD AND RETURN WITH PARLAUFD INCL F110V-LAUFD
* WITH PARLAUFI INCL F110V-LAUFI
* VIA SELECTION-SCREEN.
*------- Vorschlagslauf Loeschen ---------------------------------------
WHEN 'VODE'.
* break c_xiangc.
CLEAR:LS_ZTYJ_FK_STATUS.
SELECT SINGLE *
INTO LS_ZTYJ_FK_STATUS
FROM ZTYJ_FK_STATUS
WHERE LAUFD = F110V-LAUFD
AND LAUFI = F110V-LAUFI
AND ZCHEC = 'X'.
IF SY-SUBRC EQ 0.
* MESSAGE S020(ZYUEJIN_FICO) WITH F110V-LAUFD F110V-LAUFI DISPLAY LIKE 'E'.
* EXIT.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = '请确认'
text_question = '此付款ID在审核中,是否确认删除?'
text_button_1 = '确认删除'
text_button_2 = '不删除'
default_button = '1' "缺省选中按钮: 1 是; 2 否
display_cancel_button = '' "标识: 为空,不显示 取消按钮
IMPORTING
answer = lv_answer "1 是;
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF lv_answer EQ '1'.
UPDATE ztyj_fk_status SET zchec = ' '
datum = sy-datum
uzeit = sy-uzeit
usnam = sy-uname
WHERE laufd = F110V-laufd
AND laufi = F110V-laufi.
MESSAGE S023(ZYUEJIN_FICO) WITH F110V-LAUFD F110V-LAUFI.
else.
exit.
ENDIF.
ENDIF.
WHEN OTHERS.
...
ENDCASE.
ENDENHANCEMENT.
Transaction Code - F110 自动付款参数
BADI Name Description
FI_BSTM_MC_EXIT FI 帐户报表: 多项兑现转化的退出
FI_F110_SCHEDULE_JOB F110: 在建议/更新运行计划安排前的检查
No of BADIs: 2
2.F110 付款运行前的 解除凭证行项目冻结标记增强
SE19 :FI_F110_SCHEDULE_JOB
F110: 在建议/更新运行计划安排前的检查
实现方式:SE24
ZCL_IM_FI_F110_SCHEDULE_JB
代码:
METHOD IF_EX_FI_F110_SCHEDULE_JOB~CHECK_PARAMETER.
**供应商所有付款建议有冻结的凭证全部解冻结
TYPE-POOLS: TPIT.
FIELD-SYMBOLS <FS_LIFNR> TYPE STANDARD TABLE.
TYPES: BEGIN OF T_BSEG,
BUKRS TYPE BSEG-BUKRS,
BELNR TYPE BSEG-BELNR,
GJAHR TYPE BSEG-GJAHR,
BUZEI TYPE BSEG-BUZEI,
KOART TYPE BSEG-KOART,
END OF T_BSEG.
DATA: LS_REGUV TYPE REGUV,
LV_FIELD(20),
LT_BSIK TYPE TABLE OF BSIK,
LS_BSIK TYPE BSIK,
LT_BSEG TYPE TABLE OF T_BSEG,
LS_BSEG TYPE T_BSEG,
S_BSEG TYPE BSEG,
LT_BUZTAB TYPE TPIT_T_BUZTAB,
LS_BUZTAB TYPE LINE OF TPIT_T_BUZTAB,
LT_FLDTAB TYPE TPIT_T_FNAME,
LS_FLDTAB TYPE LINE OF TPIT_T_FNAME,
LT_ERRTAB TYPE TPIT_T_ERRDOC,
LS_ERRTAB TYPE LINE OF TPIT_T_ERRDOC,
LR_LIFNR TYPE FAGL_RANGE_T_LIFNR,
LS_LIFNR TYPE FAGL_RANGE_S_LIFNR.
** BREAK-POINT.
** CHECK 1 = 2.
**F110 自动付款时: 参数已输入和收付建议已经建立才跑解冻结
** 状态:点按钮"付款运行"时执行以下解冻结逻辑
* CHECK I_F110V-BUKLS+0(4) = 'CV50' OR I_F110V-BUKLS+0(4) = 'CV51'.
CLEAR: LS_REGUV.
SELECT SINGLE * INTO LS_REGUV
FROM REGUV
WHERE LAUFD = I_F110V-LAUFD
AND LAUFI = I_F110V-LAUFI.
CHECK LS_REGUV-XVORE = 'X' AND LS_REGUV-XECHT IS INITIAL.
**取供应商
REFRESH:LR_LIFNR,LT_BSIK,LT_BSEG.
LV_FIELD = '(SAPF110V)R_LIFNR[]'.
ASSIGN (LV_FIELD) TO <FS_LIFNR>.
IF <FS_LIFNR>[] IS ASSIGNED.
LR_LIFNR[] = <FS_LIFNR>[].
UNASSIGN <FS_LIFNR>.
ENDIF.
**取供应商已被冻结的数据
SELECT * INTO TABLE LT_BSIK
FROM BSIK
WHERE BUKRS = I_F110V-BUKLS+0(4)
AND GJAHR = I_F110V-LAUFD+0(4)
AND LIFNR IN LR_LIFNR
** AND BSTAT = SPACE
** AND BSCHL = '31'
AND ZLSPR = 'X'. "X:(跃进)自动付款冻结
CHECK LT_BSIK[] IS NOT INITIAL.
**取科目类型
SELECT BUKRS BELNR GJAHR BUZEI KOART
INTO CORRESPONDING FIELDS OF TABLE LT_BSEG
FROM BSEG
FOR ALL ENTRIES IN LT_BSIK
WHERE BUKRS = LT_BSIK-BUKRS
AND BELNR = LT_BSIK-BELNR
AND GJAHR = LT_BSIK-GJAHR
AND BUZEI = LT_BSIK-BUZEI.
SORT LT_BSEG BY BUKRS BELNR GJAHR BUZEI.
LOOP AT LT_BSIK INTO LS_BSIK.
CLEAR: S_BSEG,LS_BSEG,LS_FLDTAB,LT_FLDTAB[],
LS_FLDTAB,LT_FLDTAB[],LS_ERRTAB,LT_ERRTAB[].
READ TABLE LT_BSEG INTO LS_BSEG WITH KEY BUKRS = LS_BSIK-BUKRS
BELNR = LS_BSIK-BELNR
GJAHR = LS_BSIK-GJAHR
BUZEI = LS_BSIK-BUZEI
BINARY SEARCH.
LS_BUZTAB-BUKRS = LS_BSIK-BUKRS.
LS_BUZTAB-BELNR = LS_BSIK-BELNR.
LS_BUZTAB-GJAHR = LS_BSIK-GJAHR.
LS_BUZTAB-BUZEI = LS_BSIK-BUZEI.
LS_BUZTAB-KOART = LS_BSEG-KOART.
LS_BUZTAB-BSCHL = LS_BSIK-BSCHL.
APPEND LS_BUZTAB TO LT_BUZTAB.
LS_FLDTAB-FNAME = 'ZLSPR'.
APPEND LS_FLDTAB TO LT_FLDTAB.
**
CALL FUNCTION 'FI_ITEMS_MASS_CHANGE'
EXPORTING
S_BSEG = S_BSEG
IMPORTING
ERRTAB = LT_ERRTAB
TABLES
IT_BUZTAB = LT_BUZTAB
IT_FLDTAB = LT_FLDTAB
EXCEPTIONS
BDC_ERRORS = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
EXIT.
ENDIF.
ENDLOOP.
ENDMETHOD.
3.财务凭证项目付款条件替代
*---------------------------------------------------------------------*
* FORM Z002 *
*---------------------------------------------------------------------*
*替代付款方式:BSEG-ZTERM
*1.系统根据BSEG-BUKRS(公司代码)=(CV50,CV51,CV52),
* BSEG-KOART(科目类型)=K,
* 根据BSEG-LIFNR(供应商账号)到LFB1-LIFNR=BSEG-LIFNR,
* LFB1-BUKRS=BESG-BUKRS(公司代码),找到LFB1-ZTERM赋值给BSEG-ZTERM
*
*---------------------------------------------------------------------*
FORM Z002.
*BREAK-POINT.
*&--->add on 16.05.2017 10:30:38 by cx.
DATA:l_zterm TYPE lfb1-zterm.
CLEAR:l_zterm.
SELECT SINGLE zterm
INTO l_zterm
FROM lfb1
WHERE lifnr = bseg-lifnr
AND bukrs = bseg-bukrs.
IF l_zterm NE space.
CONDENSE l_zterm NO-GAPS.
bseg-zterm = l_zterm.
ENDIF.
*&--->end add.
ENDFORM.