Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Tax issues in BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
784

Hi Friends,

We have a requirement wherein, the incoming invoice details for the AP Interface have a single Customer Line and multiple G/L lines (with G/L amounts EXCLUSIVE of tax). For eg: If the amount at Customer Line is +6700, the sum of the amounts of G/L lines willl be -6000. Currently, we are calculating the tax for each of the G/L lines based on the Tax Code and Tax Jurisdiction. For this, we are using the Function Module - CALCULATE_TAX_FROM_NET_AMOUNT and populating the BAPI tax lines as shown herein:

  • Calculate tax from the base amount using FM

CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'

EXPORTING

i_bukrs = lv_bukrs

i_mwskz = lv_mwskz

i_txjcd = gv_txjcd

i_waers = lv_waers

i_wrbtr = lv_wrbtr

IMPORTING

e_fwast = lv_taxded

TABLES

t_mwdat = lt_mwdat

EXCEPTIONS

bukrs_not_found = 1

country_not_found = 2

mwskz_not_defined = 3

mwskz_not_valid = 4

ktosl_not_found = 5

kalsm_not_found = 6

parameter_error = 7

knumh_not_found = 8

kschl_not_found = 9

unknown_error = 10

account_not_found = 11

txjcd_not_valid = 12

OTHERS = 13.

IF sy-subrc EQ 0.

LOOP AT lt_mwdat INTO ls_mwdat WHERE wmwst IS NOT INITIAL.

  • Increment the Line Item Number

gv_no_item = gv_no_item + 1.

  • Populate the tax table

ls_bapitax-itemno_acc = gv_no_item.

ls_bapitax-gl_account = ls_mwdat-hkont.

ls_bapitax-acct_key = ls_mwdat-ktosl.

ls_bapitax-tax_code = lv_mwskz.

ls_bapitax-taxjurcode = ls_mwdat-txjcd.

ls_bapitax-taxjurcode_deep = ls_mwdat-txjcd_deep.

ls_bapitax-taxjurcode_level = ls_mwdat-txjlv.

ls_bapitax-tax_rate = ls_mwdat-msatz.

ls_bapitax-itemno_tax = gv_no_item - 1.

ls_bapitax-tax_date = sy-datum.

ls_bapitax-cond_key = ls_mwdat-kschl.

APPEND ls_bapitax TO ct_bapitax.

CLEAR ls_bapitax.

  • Populate the currency table

ls_curr-itemno_acc = gv_no_item.

ls_curr-amt_doccur = ls_mwdat-wmwst. " Net amount after tax

ls_curr-amt_base = lv_wrbtr.

ls_curr-tax_amt = ls_mwdat-wmwst.

ls_curr-currency = ls_head-waers. " Currency is at header

APPEND ls_curr TO ct_currency.

CLEAR ls_curr.

ENDLOOP.

ENDIF.

However, this approach is not working as, the tax amount is now getting split into multiple lines. This split is happening against the different Profit Centres populated in the G/L lines. This happens ONLY in the 'General Ledger View' of the transaction FB03.

It would be great if anyone could suggest what the problem is herein.

Thanks in advance!!

Anju.

2 REPLIES 2
Read only

Former Member
0 Likes
484

Hi Anju ,

i dont see any probs in this ? , yes it will creates multiple lines based on the Profit centres that too in GL view only , as per my knowledge its SAP standard ? so whats the issue ? , what ur functional ppls are saying ?

Regards

Prabhu

Read only

0 Likes
484

Thanks for the reply Prabhu..

As per the Functional Consultants, the Customer line item should be split across Profit Centers.

However, the Tax Lines should not be split. Could you suggest what to do about this??

Thanks.

Anju.