增强方式:替代,【替代基本用在FICO模块】
BTE增强方式应用更广,需要学习总结。
程序:ZRGGBS*
步骤 1,SE16N:GB01 将 ZBD1T排除标记置为空,【注意,此更改跨client,dev700 修改,test710 也被修改】
通 ZTERM
排除
9SBSEGZBD1TX
9SBSEGZTERM
2.替代程序RGUGBR00 重新运行;
应用领域 *
调用点 *
使用标准变式:SAP&OIBSEGBKPF
运行结果:成功完成存储和生成
消息号 GB000
3.程序zrggbs000 代码增强
*---------------------------------------------------------------------*
* 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.
*&--->add on 16.05.2017 10:30:38 by cx.
DATA:l_zterm TYPE lfb1-zterm.
DATA:l_nzterm TYPE lfb1-zterm.
DATA:l_nzfbdt TYPE bseg-zfbdt.
DATA:l_ozterm TYPE lfb1-zterm.
DATA:l_nsklin TYPE sklin,
l_osklin TYPE sklin.
DATA:l_ozfbdt TYPE bseg-zfbdt.
DATA:e_sklin TYPE sklin,
e_zfbdt TYPE bseg-zfbdt.
*break c_xiangc.
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.
**用付款条件,找付款基准日期,天数/百分比,
IF l_zterm IS NOT INITIAL AND l_zterm NE bseg-zterm .
CLEAR:e_sklin,e_zfbdt.
CALL FUNCTION 'FI_FIND_PAYMENT_CONDITIONS'
EXPORTING
i_zterm = l_zterm
i_bldat = bkpf-bldat
i_budat = bkpf-budat
i_cpudt = bkpf-cpudt
i_zfbdt = bseg-zfbdt
* I_FUNCL = ' '
* I_REINDAT =
* I_PPA_EX_IND =
* I_LIFNR =
* I_BUKRS =
IMPORTING
* E_T052 =
e_zfbdt = e_zfbdt
e_sklin = e_sklin
* E_XSPLT =
EXCEPTIONS
terms_incorrect = 1
terms_not_found = 2
no_date_entered = 3
no_day_limit_found = 4
OTHERS = 5
.
*IF sy-subrc <> 0.
*MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ELSE.
*MESSAGE s001(00) WITH '替代成功!'.
*ENDIF.
*&--->替代基准日期
IF e_zfbdt NE space.
bseg-zfbdt = e_zfbdt.
ENDIF.
**天数
bseg-zbd1t = e_sklin-ztag1.
bseg-zbd1p = e_sklin-zprz1.
bseg-zbd2t = e_sklin-ztag2.
bseg-zbd2p = e_sklin-zprz2.
bseg-zbd3t = e_sklin-ztag3.
**付款条件
bseg-zterm = l_zterm.
ENDIF.
ENDIF.
*&--->end add.
ENDFORM. "Z001
*&------------------------------------------------------------------------
FORM z002.
*BREAK-POINT.
*&--->add on 16.05.2017 10:30:38 by cx.
DATA:l_zterm TYPE lfb1-zterm.
DATA:l_nzterm TYPE lfb1-zterm.
DATA:l_nzfbdt TYPE bseg-zfbdt.
DATA:l_ozterm TYPE lfb1-zterm.
DATA:l_nsklin TYPE sklin,
l_osklin TYPE sklin.
DATA:l_ozfbdt TYPE bseg-zfbdt.
DATA:e_sklin TYPE sklin.
BREAK-POINT.
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-zbd1t = 111.
**替代天数
IF l_zterm NE bseg-zterm .
CLEAR:e_sklin.
CALL FUNCTION 'FI_CHANGE_PAYMENT_CONDITIONS'
EXPORTING
* I_BLDAT = SY-DATLO
* I_BUDAT = SY-DATLO
* I_CPUDT =
i_newzterm = l_zterm
i_newzfbdt = bseg-zfbdt
i_newsklin = l_nsklin
i_oldzterm = bseg-zterm
i_oldzfbdt = bseg-zfbdt
i_oldsklin = l_osklin
* I_ZLSCH =
* I_ZSCHF =
* I_OLDZLSCH =
* I_OLDZSCHF =
* I_ZBDREQ = ' '
* I_ZFBDTREQ = ' '
* I_ZLSCHREQ = ' '
* I_ZSCHFREQ = ' '
* I_SPLITMODE = ' '
* I_LIFNR =
* I_BUKRS =
* I_XDERIVE =
IMPORTING
* E_ZTERM =
* E_ZFBDT =
e_sklin = e_sklin
* E_STATUS =
* E_ZLSCH =
* E_ZSCHF =
* CHANGING
* C_T052 =
* C_REINDAT =
EXCEPTIONS
terms_incorrect = 1
terms_not_found = 2
wrong_zfbdt = 3
day_limit_not_found = 4
OTHERS = 5
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
bseg-zbd1t = e_sklin-ztag1.
bseg-zterm = l_zterm.
ENDIF.
ENDIF.
*&--->end add.
ENDFORM. "Z001
*&------------------------------------------------------------------------
付款条件增强:
BSEG-ZTERM -> BSEG-ZBD1T
使用函数:FI_FIND_PAYMENT_CONDITIONS.
*输入:
I_ZTERM Z020
I_BLDAT 2017.05.22
I_BUDAT 2017.05.22
I_CPUDT 2017.05.22
I_ZFBDT 20170523
*输出:
*基准日期,
E_ZFBDT 2017.05.22
返回 E_T052
付款条件数据表
E_SKLIN
*
ZTAG1 020
ZPRZ1 0.000
ZTAG2 000
ZPRZ2 0.000
ZTAG3 000
付款条件 -> 天数
Z060
*&--->替代基准日期
IF e_zfbdt NE space.
bseg-zfbdt = e_zfbdt.
ENDIF.
bseg-zbd1t = e_sklin-ztag1.**天数
bseg-zbd1p = e_sklin-zprz1.*现金折扣百分率
bseg-zbd2t = e_sklin-ztag2.*现金折扣天数2
bseg-zbd2p = e_sklin-zprz2.*现金折扣百分比2
bseg-zbd3t = e_sklin-ztag3.*净支付条件期段
**付款条件
bseg-zterm = l_zterm.
/ GBTQ8FIB
/ SUB_SMCV IF COND = B_TRUE . PERFORM Z002(ZRGGBS000) IF FOUND . PERFORM Z002(ZRGGBS000) IF FOUND . PERFORM Z002(ZRGGBS000) IF FOUND . PERFORM Z002(ZRGGBS000) IF FOUND . PERFORM Z002(ZRGGBS000) IF FOUND . PERFORM Z002(ZRGGBS000) IF FOUND . PERFORM Z002(ZRGGBS000) IF FOUND . G_SUBST_PERFORMED = B_TRUE.
ENDIF. CLEAR:e_sklin.
CALL FUNCTION 'FI_CHANGE_PAYMENT_CONDITIONS'
EXPORTING
i_bldat = bkpf-bldat
i_budat = bkpf-budat
* I_CPUDT =
i_newzterm = l_zterm
i_newzfbdt = bseg-zfbdt
i_newsklin = l_nsklin
i_oldzterm = bseg-zterm
i_oldzfbdt = bseg-zfbdt
i_oldsklin = l_osklin
* I_ZLSCH =
* I_ZSCHF =
* I_OLDZLSCH =
* I_OLDZSCHF =
* I_ZBDREQ = ' '
* I_ZFBDTREQ = ' '
* I_ZLSCHREQ = ' '
* I_ZSCHFREQ = ' '
* I_SPLITMODE = ' '
* I_LIFNR =
* I_BUKRS =WW
* I_XDERIVE =
IMPORTING
* E_ZTERM =
* E_ZFBDT =
e_sklin = e_sklin
* E_STATUS =
* E_ZLSCH =
* E_ZSCHF =
* CHANGING
* C_T052 =
* C_REINDAT =
EXCEPTIONS
terms_incorrect =
terms_not_found =
wrong_zfbdt =
day_limit_not_found =
OTHERS =
.
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
MESSAGE s001() WITH '替代成功!'.
ENDIF.