1、SE18:增强点BADI_SD_BILLING
2、增强实施:SIPT_SD_BILLING
3、方法:INVOICE_DOCUMENT_CHECK
4、代码实现(隐式增强)
ENHANCEMENT 1 ZIM_INVOCE_CHECK. "active version
* CHECK SY-TCODE = 'VF01' OR SY-TCODE = 'VF04' OR SY-CPROG = 'SDBILLDL'.
DATA:WS_VBRKVB TYPE VBRKVB.
DATA:WS_FXVBRP TYPE VBRPVB.
DATA:WADAT_IST TYPE LIKP-WADAT_IST.
DATA:lv_dummy TYPE C.
DATA:lv_err TYPE C.
"FKDAT
LOOP AT FXVBRK INTO WS_VBRKVB.
LOOP AT FXVBRP INTO WS_FXVBRP WHERE VBELN = WS_VBRKVB-VBELN.
IF WS_FXVBRP-VGBEL IS NOT INITIAL.
CLEAR WADAT_IST.
SELECT SINGLE WADAT_IST INTO WADAT_IST FROM LIKP WHERE VBELN = WS_FXVBRP-VGBEL.
IF WS_VBRKVB-FKDAT < WADAT_IST.
FBAD_DATA = 'X'.
IF sy-tcode = 'ZSD170A' AND SY-CPROG = 'ZSD170A'.
MESSAGE e078(ZSD) INTO lv_dummy.
CALL FUNCTION 'SIPT_VBFS_CREATE_MESSAGE_SD'
EXPORTING
IV_VBELN = WS_VBRKVB-VBELN
IV_POSNR = '000000'
IV_MSGID = SY-MSGID
IV_MSGTY = SY-MSGTY
IV_MSGNO = SY-MSGNO
IV_MSGV1 = '开票日期不允许小于发货日期!'
IV_MSGV2 = SY-MSGV2
IV_MSGV3 = SY-MSGV3
IV_MSGV4 = SY-MSGV4.
ELSE.
MESSAGE W078(ZSD) DISPLAY LIKE 'E'.
ENDIF.
" lv_err = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
* IF lv_err = 'X'.
* MESSAGE e078(ZSD) .
* FBAD_DATA = 'X'.
* " MESSAGE W078(ZSD) DISPLAY LIKE 'E'.
* ENDIF.
ENDENHANCEMENT.