SAP TAX CODE 自动计算税金(BAPI_ACC_DOCUMENT_POST CALCULATE_TAX_FROM_GROSSAMOUNT)

CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'

  EXPORTING

    i_bukrs   = '1000'  "公司代码

    i_mwskz = 'X1'        "税码

    i_waers  = 'CNY'       "币种

    i_wrbtr   = amount   "金额

 TABLES

    T_MWDAT  = t_tax_info.

 

* Now I loop the t_tax_info table in order to fill the ACCOUNTTAX and CURRENCYAMOUNT tables:LOOP AT t_tax_info.

LOOP AT t_tax_info.

  CLEAR ls_accounttax.

  ls_accounttax-itemno_acc = sy-tabix + 1.

  ls_accounttax-tax_code = 'X1'.

  ls_ACCOUNTTAX-ACCT_KEY   = t_tax_info-KTOSL.

  ls_ACCOUNTTAX-COND_KEY   = t_tax_info-KSCHL.

  ls_ACCOUNTTAX-TAXJURCODE = t_tax_info-TXJCD.

  ls_ACCOUNTTAX-TAXJURCODE_DEEP  = t_tax_info-TXJCD_DEEP.

  ls_ACCOUNTTAX-TAXJURCODE_LEVEL = t_tax_info-TXJLV.

  APPEND ls_accounttax TO accounttax.

 

  CLEAR ls_currencyamount.

  ls_currencyamount-itemno_acc = ls_accounttax-itemno_acc.

  ls_currencyamount-currency   = 'CNY'.

  ls_currencyamount-amt_doccur = t_tax_info-wmwst.

  ls_currencyamount-amt_base = t_tax_info-KAWRT.  "<-----------It's not the base, but gross amount

  APPEND ls_currencyamount TO currencyamount.

 

ENDLOOP.

 

 

 U're using CALCULATE_TAX_FROM_GROSSAMOUNT, so the amount transfered to that fm is not the base amount, but it's  the gross amount

 

 

你可能感兴趣的:(document)