实施隐式增强
全部代码如下:
method IF_EX_BADI_SD_BILLING~INVOICE_DOCUMENT_CHECK.
CALL FUNCTION ‘SIPT_DOC_CHECK_SD’
EXPORTING
it_xvbrk = fxvbrk
it_xvbrp = fxvbrp
it_xkomv = fxkomv
it_xvbpa = fxvbpa
IMPORTING
ev_bad_data = fbad_data.
“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”"
"
"
"\SE:(1) Class SIPT_SD_BILLING, Interface IF_EX_BADI_SD_BILLING, Method INVOICE_DOCUMENT_CHECK, End A
∗
*
∗-Start: (1)---------------------------------------------------------------------------------
∗
*
∗
ENHANCEMENT 1 ZE_VF01. "active version
DATA:lv_netwr TYPE vbrp-netwr.
DATA:lv_low_netwr TYPE vbrp-netwr.
DATA:lv_msgv2 TYPE symsgv.
DATA:lv_dummy TYPE c.
INCLUDE zenhance_001.
"VF01销售开票发票金额控制增强
SELECT SINGLE low INTO @DATA(lv_low)
FROM tvarvc
WHERE name = ‘ZSD_ZSD047_JINEKAKONG’.
IF sy-subrc = 0 AND lv_low IS NOT INITIAL.
CONDENSE lv_low NO-GAPS.
lv_low_netwr = lv_low.
LOOP AT fxvbrk INTO DATA(ls_xvbrk).
CLEAR:lv_netwr.
LOOP AT fxvbrp INTO DATA(ls_xvbrp) WHERE vbeln = ls_xvbrk-vbeln.
lv_netwr += ls_xvbrp-netwr.
lv_netwr += ls_xvbrp-mwsbp.
ENDLOOP.
IF lv_netwr > lv_low_netwr.
lv_msgv2 = lv_low.
"记录发票开票日志,如果是BAPI调用,传输日志到BAPI
MESSAGE e001(00) WITH '发票总金额不能超过' lv_low INTO lv_dummy.
CALL FUNCTION 'SIPT_VBFS_CREATE_MESSAGE_SD'
EXPORTING
iv_vbeln = ls_xvbrk-vbeln
iv_posnr = '000000'
iv_msgid = sy-msgid
iv_msgty = sy-msgty
iv_msgno = sy-msgno
iv_msgv1 = sy-msgv1
iv_msgv2 = lv_msgv2
iv_msgv3 = sy-msgv3
iv_msgv4 = sy-msgv4.
IF sy-batch IS INITIAL AND sy-tcode+0(1) <> 'Z'.
"标准事务代码前台直接报错
MESSAGE e001(00) WITH '发票总金额不能超过' lv_low.
ELSE.
"后台作业则设置此标记终止该发票的生成
fbad_data = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDENHANCEMENT.
∗
*
∗-End: (1)---------------------------------------------------------------------------------
∗
*
∗
ENDMETHOD.