本文主要是介绍VF01销售开票发票金额控制增强,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
实施隐式增强
全部代码如下:
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调用,传输日志到BAPIMESSAGE e001(00) WITH '发票总金额不能超过' lv_low INTO lv_dummy.CALL FUNCTION 'SIPT_VBFS_CREATE_MESSAGE_SD'EXPORTINGiv_vbeln = ls_xvbrk-vbelniv_posnr = '000000'iv_msgid = sy-msgidiv_msgty = sy-msgtyiv_msgno = sy-msgnoiv_msgv1 = sy-msgv1iv_msgv2 = lv_msgv2iv_msgv3 = sy-msgv3iv_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.
这篇关于VF01销售开票发票金额控制增强的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!