以下是纯顾问群~
微信群:SAP干货铺,请联系本人微信 sapliumeng。
QQ群 :SAP干货铺, 群号:775662808
所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!
微信群:SAP干货铺,请联系本人微信 sapliumeng。
QQ群 :SAP干货铺, 群号:775662808
所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!
*&---------------------------------------------------------------------*
*& Report ZLM_MIRO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZLM_MIRO .
DATA : LS_HEADERDATA LIKE BAPI_INCINV_CREATE_HEADER ,
LT_RETURN LIKE TABLE OF BAPIRET2 ,
LS_RETURN LIKE BAPIRET2 ,
LV_INVOICEDOCNUMBER LIKE BAPI_INCINV_FLD -INV_DOC_NO .
DATA :LT_TAXDATA TYPE TABLE OF BAPI_INCINV_CREATE_TAX .
DATA :LS_TAXDATA TYPE BAPI_INCINV_CREATE_TAX .
DATA :LT_ITEMDATA TYPE TABLE OF BAPI_INCINV_CREATE_ITEM .
DATA :LS_ITEMDATA TYPE BAPI_INCINV_CREATE_ITEM .
DATA :LT_MATERIALDATA LIKE TABLE OF BAPI_INCINV_CREATE_MATERIAL .
DATA :LS_MATERIALDATA LIKE BAPI_INCINV_CREATE_MATERIAL .
DATA :LV_ITEM TYPE RBLGP .
DATA :LV_GROSS TYPE BAPI_RMWWR .
PARAMETERS P_MATNR TYPE MATNR DEFAULT 'V700000526' .
PARAMETERS P_AMOUNT TYPE BAPIWRBTR DEFAULT '9' .
PARAMETERS P_BWKEY TYPE BWKEY DEFAULT '9110' .
PARAMETERS P_UOM TYPE MEINS DEFAULT 'EA' .
PARAMETERS P_MENGE TYPE MENGE_D DEFAULT '1' .
PARAMETERS P_TAX TYPE MWSKZ_MRM DEFAULT 'J1' .
PARAMETERS P_CA_TAX AS CHECKBOX DEFAULT 'X' . "自动计算税费
LS_MATERIALDATA -INVOICE_DOC_ITEM = 1 .
LS_MATERIALDATA -MATERIAL = P_MATNR .
LS_MATERIALDATA -DB_CR_IND = 'H' .
LS_MATERIALDATA -ITEM_AMOUNT = P_AMOUNT .
LS_MATERIALDATA -QUANTITY = P_MENGE .
LS_MATERIALDATA -TAX_CODE = P_TAX .
LS_MATERIALDATA -BASE_UOM = P_UOM .
LS_MATERIALDATA -VAL_AREA = P_BWKEY .
APPEND LS_MATERIALDATA TO LT_MATERIALDATA .
LV_GROSS = LV_GROSS P_AMOUNT P_AMOUNT * 17 / 100 .
*&header
CLEAR : LS_HEADERDATA .
LS_HEADERDATA -INVOICE_IND = '' . "贷项凭证
LS_HEADERDATA -GROSS_AMOUNT = LV_GROSS .
LS_HEADERDATA -BLINE_DATE = SY -DATUM .
LS_HEADERDATA -DIFF_INV = 'S0021' .
LS_HEADERDATA -REF_DOC_NO = '4690000030' .
LS_HEADERDATA -DOC_DATE = SY -DATUM .
LS_HEADERDATA -PSTNG_DATE = SY -DATUM .
LS_HEADERDATA -COMP_CODE = '9110' . .
LS_HEADERDATA - CURRENCY = 'CNY' .
LS_HEADERDATA -CURRENCY_ISO = 'CNY' .
LS_HEADERDATA -CALC_TAX_IND = 'X' .
LS_HEADERDATA -PMNTTRMS = '0001' .
LS_HEADERDATA -ITEM_TEXT = 'text' .
LS_HEADERDATA -GROSS_AMOUNT = LV_GROSS .
IF P_CA_TAX IS INITIAL .
LS_HEADERDATA -CALC_TAX_IND = ' ' .
CLEAR LS_TAXDATA .
LS_TAXDATA -TAX_CODE = 'J1' .
LS_TAXDATA -TAX_AMOUNT = P_AMOUNT * 17 / 100 . " demo 默认17%,
LS_TAXDATA -ITEMNO_TAX = 1 .
APPEND LS_TAXDATA TO LT_TAXDATA .
ENDIF .
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
HEADERDATA
*& Report ZLM_MIRO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZLM_MIRO .
DATA : LS_HEADERDATA LIKE BAPI_INCINV_CREATE_HEADER ,
LT_RETURN LIKE TABLE OF BAPIRET2 ,
LS_RETURN LIKE BAPIRET2 ,
LV_INVOICEDOCNUMBER LIKE BAPI_INCINV_FLD -INV_DOC_NO .
DATA :LT_TAXDATA TYPE TABLE OF BAPI_INCINV_CREATE_TAX .
DATA :LS_TAXDATA TYPE BAPI_INCINV_CREATE_TAX .
DATA :LT_ITEMDATA TYPE TABLE OF BAPI_INCINV_CREATE_ITEM .
DATA :LS_ITEMDATA TYPE BAPI_INCINV_CREATE_ITEM .
DATA :LT_MATERIALDATA LIKE TABLE OF BAPI_INCINV_CREATE_MATERIAL .
DATA :LS_MATERIALDATA LIKE BAPI_INCINV_CREATE_MATERIAL .
DATA :LV_ITEM TYPE RBLGP .
DATA :LV_GROSS TYPE BAPI_RMWWR .
PARAMETERS P_MATNR TYPE MATNR DEFAULT 'V700000526' .
PARAMETERS P_AMOUNT TYPE BAPIWRBTR DEFAULT '9' .
PARAMETERS P_BWKEY TYPE BWKEY DEFAULT '9110' .
PARAMETERS P_UOM TYPE MEINS DEFAULT 'EA' .
PARAMETERS P_MENGE TYPE MENGE_D DEFAULT '1' .
PARAMETERS P_TAX TYPE MWSKZ_MRM DEFAULT 'J1' .
PARAMETERS P_CA_TAX AS CHECKBOX DEFAULT 'X' . "自动计算税费
LS_MATERIALDATA -INVOICE_DOC_ITEM = 1 .
LS_MATERIALDATA -MATERIAL = P_MATNR .
LS_MATERIALDATA -DB_CR_IND = 'H' .
LS_MATERIALDATA -ITEM_AMOUNT = P_AMOUNT .
LS_MATERIALDATA -QUANTITY = P_MENGE .
LS_MATERIALDATA -TAX_CODE = P_TAX .
LS_MATERIALDATA -BASE_UOM = P_UOM .
LS_MATERIALDATA -VAL_AREA = P_BWKEY .
APPEND LS_MATERIALDATA TO LT_MATERIALDATA .
LV_GROSS = LV_GROSS P_AMOUNT P_AMOUNT * 17 / 100 .
*&header
CLEAR : LS_HEADERDATA .
LS_HEADERDATA -INVOICE_IND = '' . "贷项凭证
LS_HEADERDATA -GROSS_AMOUNT = LV_GROSS .
LS_HEADERDATA -BLINE_DATE = SY -DATUM .
LS_HEADERDATA -DIFF_INV = 'S0021' .
LS_HEADERDATA -REF_DOC_NO = '4690000030' .
LS_HEADERDATA -DOC_DATE = SY -DATUM .
LS_HEADERDATA -PSTNG_DATE = SY -DATUM .
LS_HEADERDATA -COMP_CODE = '9110' . .
LS_HEADERDATA - CURRENCY = 'CNY' .
LS_HEADERDATA -CURRENCY_ISO = 'CNY' .
LS_HEADERDATA -CALC_TAX_IND = 'X' .
LS_HEADERDATA -PMNTTRMS = '0001' .
LS_HEADERDATA -ITEM_TEXT = 'text' .
LS_HEADERDATA -GROSS_AMOUNT = LV_GROSS .
IF P_CA_TAX IS INITIAL .
LS_HEADERDATA -CALC_TAX_IND = ' ' .
CLEAR LS_TAXDATA .
LS_TAXDATA -TAX_CODE = 'J1' .
LS_TAXDATA -TAX_AMOUNT = P_AMOUNT * 17 / 100 . " demo 默认17%,
LS_TAXDATA -ITEMNO_TAX = 1 .
APPEND LS_TAXDATA TO LT_TAXDATA .
ENDIF .
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
HEADERDATA