Skip to Content
0
Former Member
Dec 01, 2006 at 03:30 PM

BAPI_ACC_DOCUMENT_POST with tax posting

434 Views

Hi;

I have implemented BAPI_ACC_DOCUMENT_POST to post some items and a related vendor document. The program runs fine and creates documents for all lines and an additional line for vendor. But when i want to add a tax line nothing happens. The code for adding tax line data is as follows:

CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'

EXPORTING

I_BUKRS = '1100'

I_MWSKZ = mwskz

  • I_TXJCD = ' '

I_WAERS = waers

I_WRBTR = toplam

  • I_ZBD1P = 0

  • I_PRSDT =

  • I_PROTOKOLL =

  • I_TAXPS =

  • I_ACCNT_EXT =

  • IS_ENHANCEMENT =

  • IMPORTING

  • E_FWNAV = vergi

  • E_FWNVV =

  • E_FWSTE = vergi

  • E_FWAST =

TABLES

T_MWDAT = vergi

EXCEPTIONS

BUKRS_NOT_FOUND = 1

COUNTRY_NOT_FOUND = 2

MWSKZ_NOT_DEFINED = 3

MWSKZ_NOT_VALID = 4

ACCOUNT_NOT_FOUND = 5

DIFFERENT_DISCOUNT_BASE = 6

DIFFERENT_TAX_BASE = 7

TXJCD_NOT_VALID = 8

NOT_FOUND = 9

KTOSL_NOT_FOUND = 10

KALSM_NOT_FOUND = 11

PARAMETER_ERROR = 12

KNUMH_NOT_FOUND = 13

KSCHL_NOT_FOUND = 14

UNKNOWN_ERROR = 15

OTHERS = 16

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

tax-itemno_acc = line + 2. "accounttax

tax-gl_account = vergi-hkont.

tax-tax_code = mwskz.

tax-acct_key = vergi-ktosl.

tax-cond_key = vergi-kschl.

append tax.

  • it_accounttax-acct_key = 'VST'.

clear amount. "currency amount

amount-itemno_acc = line + 2.

amount-currency = waers. "'TRY'.

amount-currency_iso = waers.

amount-curr_type = '00'.

  • amount-amt_doccur = toplam." - vergi-wmwst.

amount-amt_base = vergi-wmwst.

  • amount-tax_amt = vergi-wmwst.

append amount.

the tax function calculates the tax amount correctly (eg. for an amount of 600 gross and tax rate 1% the tax is 5,94) but BAI does not create the relevant tax line.

Can someone help?

Thx

Ali