cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance needed in BAPI_ACC_DOCUMENT_POST (FI) for Down payment with TDS

former_member429315
Discoverer
0 Kudos

Hi Team,

Vendor advance /down payment entry with TDS can be posted manually thru T code F-48 however when we are trying to post the same entry thru Bapi (FM), SE37 > BAPI_ACC_DOCUMENT_POST, it gets posted without TDS/it gives error.

What will be the cond type and acct key to be used for TDS. (withholding tax) as we are getting an error for the same.

Thanks

Veena.

former_member429315
Discoverer
0 Kudos

We already have data in lt_accountwt however the automatic line for TDS (withholding tax) does not get generated thru BAPI_ACC_DOCUMENT_POST.

Thanks

Veena

JonathanEemans
Active Contributor
0 Kudos

What's the error message(s) you get?

former_member816784
Discoverer
0 Kudos

Hi Veena,

Have you posted Vendor Down Payment considering withholding TAX, if Yes please provide me the reference.

Accepted Solutions (0)

Answers (1)

Answers (1)

JonathanEemans
Active Contributor
0 Kudos

Hi,

On the system I'm working on, we also use BAPI_ACC_DOCUMENT_POST with withholding tax.

First we retrieve the withholding tax info from BP...

* Fetch tax codes
  SELECT lifnr                         "Vendor Number
         witht                         "With holding tax indicator
         wt_withcd                     "with holding tax
        FROM lfbw                      "Vendor Master Record(withholding tax types) 
        INTO TABLE lt_accwt
        WHERE lifnr     EQ <Vendor Number>
          AND bukrs     EQ <Company Code>
          AND wt_subjct EQ 'X'.                    "with holding tax indicator set
  IF sy-subrc NE 0.
    CLEAR lt_accwt.
  ENDIF.

And afterwards we fill the structure in BAPI...

* fill account witholding tax for vendor
  LOOP AT lt_accwt ASSIGNING  FIELD-SYMBOL(<lfs_wt>).
    ls_accountwt-itemno_acc = gv_item_no.            "Item Number
    ls_accountwt-wt_type    = <lfs_wt>-witht.        "With holding tax indicator
    ls_accountwt-wt_code    = <lfs_wt>-wt_withcd.    "With holding tax
    CASE ls_accountwt-wt_type.                   "Indicator for Withholding Tax Type
      WHEN 'D1'.
       ls_accountwt-bas_amt_tc   = <Withholding tax base amount in document currency>.
       ls_accountwt-bas_amt_ind  = 'X'."Indicator: Withholding Tax Base Amount Entered Manually
      WHEN OTHERS.
    ENDCASE.
    APPEND ls_accountwt TO pt_lt_accountwt.
    CLEAR ls_accountwt.
  ENDLOOP.

Best regards,
Jonathan Eemans

former_member429315
Discoverer
0 Kudos

When we give tax code in ACCOUNTTAX it gives us an error as below:

Thanks

Veena

JonathanEemans
Active Contributor
0 Kudos

Hi,

If you're testing with a tax code for Tax on Sales/Purchases, check if the tax code exists for your company code via transaction FTXA.

You can use function 'CALCULATE_TAX_FROM_GROSSAMOUNT' for example to retrieve the tax information.

      CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'

        EXPORTING

          i_bukrs                 =    <company code to be added>            " company code

          i_mwskz                 =    <tax code to be added>                " tax code

          i_waers                 =    <currency to be added>                " currency

          i_wrbtr                 =    <base amount to be added>             " base amount

        IMPORTING

          e_fwste                 = lv_fwste                          "Tax calculated (total)

        TABLES

          t_mwdat                 = lt_mwdat                          "Return table

        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.<br>

FYI: we use this function as we do some checks on amounts etc.

And use this info to populate the segment ACCOUNTTAX.

      IF sy-subrc EQ 0.

        LOOP AT lt_mwdat INTO ls_mwdat.

          gv_item_no = gv_item_no + 1.                                              "Increment in the item number

          ls_accounttax-itemno_acc = gv_item_no.                                    "Item Number

          ls_accounttax-gl_account = ls_mwdat-hkont.                                "GL Account Number

          ls_accounttax-cond_key   = ls_mwdat-kschl.                                "Condition Key

          ls_accounttax-acct_key   = ls_mwdat-ktosl.                                "Account key

          ls_accounttax-tax_code   = <tax code to be added>.                        "Tax code

          ls_accounttax-tax_rate   = ls_mwdat-msatz.                                "Tax rate

          APPEND ls_accounttax TO po_lt_accounttax.

          CLEAR ls_accounttax.<br>

Best regards,
Jonathan Eemans

former_member429315
Discoverer
0 Kudos

Hi Jonathan,

We are actually trying to post a vendor advance entry/down payment. In this entry we use posting key as 29 with special GL indicator as "A" and we use a GL code for advance. We need an automatic entry to be created for TDS (withholding tax) using BAPI.

When we try posting the entry manually through T code F-48 the automatic entry for TDS (withholding tax) gets created however it does not while we create through BAPI.

We would like to also tell you that when we pass data in ACCOUNTWT and leave ACCOUNTTAX blank the entry gets posted in BAPI but however it does not give us the additional TDS line which we get through F-48. Please see below screenshot of ACCOUNTWT with the data filled.

Are we missing any data here?

Please suggest.

Thanks

Veena

JonathanEemans
Active Contributor
0 Kudos

Hi,

Check the code I've sent...Amounts should be included in BAPI.

ls_accountwt-bas_amt_tc   = <Withholding tax base amount in document currency>.
ls_accountwt-bas_amt_ind  = 'X'. "Indicator: Withholding Tax Base Amount Entered Manually

Best regards,
Jonathan Eemans

former_member816784
Discoverer
0 Kudos

Hi Jonathan,

I also face same problem as Veena faced on 07th Feb 2020. I followed all steps as you mention above but still Withholding Tax not calculated, but document post without TDS. Please help