Skip to Content
author's profile photo Former Member
Former Member

Withholding Tax

Dear All The ABAP Gurus,

I have made a Z Program for posting multiple F-47 Documents having multiple Special G/L . It is working fine . For this I have used BAPI_ACC_DOCUMENT|_POST and in that I have also used EXTENSION1 for updating the PO History also. All this is working fine when I have to post the documents without withholding Tax.

The issue is that how to post the documents for which withholding tax is to be deducted. In the BAPI there is EXTENSION2 table which is calling BADI. Should I also use BADI to resolve it. I don't know how to achieve this. Also I have used ACCOUNTWT table of the BAPI but I could not achieve success.

How to resolve this issue?

Thanks In Advance,

Bharti Jain

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

11 Answers

  • Posted on Feb 25, 2011 at 06:02 AM

    Hi,

    To add the withholding tax, you can use the ACCOUNTWT table itself.

    Pass teh following fields to the table and it should work fine.

    wa_accountwt-ITEMNO_ACC = d_item.

    wa_accountwt-WT_TYPE = Withholding tax type.

    wa_accountwt-WT_CODE = With holding Tax Code.

    Suzie

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2011 at 06:36 AM

    Thanks For The Reply,

    I have passed following entries

    WA_ACCOUNTWT-ITEMNO_ACC = 1. "Line Item

    WA_ACCOUNTWT-WT_TYPE = 'PC'.

    WA_ACCOUNTWT-WT_CODE = 'PY'.

    WA_ACCOUNTWT-BAS_AMT_LC = W_ITAB-QSSHB.

    WA_ACCOUNTWT-BAS_AMT_TC = W_ITAB-WRBTR.

    WA_ACCOUNTWT-BAS_AMT_IND = 'X'.

    APPEND WA_ACCOUNTWT TO ACCOUNTWT.

    CLEAR: WA_ACCOUNTWT.

    But It is not working.

    Thanks In Advance,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2011 at 06:51 AM

    Hi All The ABAPERS,

    How to achieve the withholding Tax Deduction issue.

    Regards,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bharti Jain,

      I have faced the dimilar problem with the BAPI "BAPI_ACC_INVOICE_RECEIPT_POST", I did the below code to achieve the result with the Withholding tax.

      Table T059Z will contain the Withholding tax code.

      With the given data read the details from T059Z table and pass it to EXTENSION table as below

      In my case I have designed the code according to the Thailand country specific, it may differ from country to country.

       CLEAR t059z.
        SELECT SINGLE * FROM t059z WHERE land1 = text-004
                                   AND witht = wa_ffile-wt_withcd.
        wt_item_th = wt_item_th + 1.
        wa_extension-field1 = 'Thailand WHT'.          "Identifier
        wa_extension-field2+0(6) = wt_item_th .        "ACCWT-WT_KEY
        wa_extension-field2+6(2) = t059z-witht.        "ACCWT-WITHT
        wa_extension-field2+8(2) = t059z-wt_withcd.    "ACCWT-WT_WITHCD
        wa_extension-field3 = wa_ffile-witht.          "Withholding tax base amount
        APPEND wa_extension TO it_extension.
      

      Then inside the BAPI use any User exit to pas the data feom EXTENSION table to ACCIT table.

      In my case ACCIT it table where i have to pass the data, please check for the similar structure and any relevant table from your BAPI and use the below code

      LOOP AT extension WHERE field1 EQ 'Thailand WHT'. "Change made specific for our requirement
        MOVE extension-field2+0(6) TO t_accwt-wt_key.
        MOVE extension-field2+6(2) TO t_accwt-witht.
        MOVE extension-field2+8(2) TO t_accwt-wt_withcd.
        MOVE extension-field3 TO t_accwt-wt_qsshb.
      *  MOVE extension-field3 TO t_accwt-wt_qbuihb.
        APPEND t_accwt.
      ENDLOOP.
      DATA l_wtkey  LIKE accit_wt-wt_key.
      l_wtkey = '000001'.
      *LOOP AT extension WHERE field1 EQ 'WHT_FLAG_TH'.    "WHT flag for the thailand
      *  MOVE extension-field2 TO l_wtkey.                  "To decide which line item to be posted
      *ENDLOOP.
      LOOP AT t_accit WHERE koart = 'K'.
        MOVE l_wtkey TO t_accit-wt_key.
        MODIFY t_accit.
        l_wtkey = l_wtkey + 1.
      ENDLOOP.
      

      I have different logic for different countries, it will be good if the above information helps you otherwise let me know so that I will try to give you another logic.

      Please give reasonable points if it is useful.

      Thanks

      Nivash S

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2011 at 08:14 AM

    Thanks For Prompt Replies.

    I have used the following tables and following code

    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

    EXPORTING

    DOCUMENTHEADER = DOCHEADER

    IMPORTING

    OBJ_TYPE = OBJ_TYPE

    OBJ_KEY = OBJ_KEY

    OBJ_SYS = OBJ_SYS

    TABLES

    ACCOUNTGL = ACCOUNTGL

    ACCOUNTPAYABLE = ACCOUNTPAY

    ACCOUNTTAX = ACCOUNTTAX

    CURRENCYAMOUNT = CURRAMOUNT

    ACCOUNTWT = ACCOUNTWT " For Withholding Tax

    EXTENSION1 = EXTENSION1 " Contains entry to update PO History

    RETURN = RETURN1.

    I have already used EXTENSION1 Table to update PO History which is working fine. I have the only option left ie to use EXTENSION2 table or to fill the entries in ACCOUNTWT (which I had already done but no success) .

    How to modify my code?

    Thanks In Advance,

    Regards,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bharti Jain,

      You can use EXTENSION1 to pass more than one set of value,

      Please use below as a hint to pass data,

      For an example you have requirement to pass the values for VALUATION TYPE, DESTINATION COUNTRY and WITHHOLDING TAX.

      Table EXTENSION1 has four fields namely FIELD1, FIELD2, FIELD3 and FIELD4.

      pass the text VALUATION TYPE in FIELD1 and the rest of data in the remaining fields and append the table

      pass the text DESTINATION COUNTRY in FIELD1 and the rest of data in the remaining fields and append the table

      pass the test WITHHOLDING TAX in the FIELD1 and the rest of the data in the remaining fields and append the table.

      Inside the BAPI using any User Exit read the table EXTENSION1 with the corresponding text to get the required values and pass them to the correct structure.

      Regards

      Nivash S

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2011 at 10:12 AM

    Thanks For Replying Me.

    I have already used the following code to fill the EXTENSION1 Table to update PO History

    MOVE W_ITAB-EBELN TO WA_EXTENSION1-FIELD1.

    MOVE W_ITAB-EBELP TO WA_EXTENSION1-FIELD2.

    MOVE W_ITAB-PROJK TO WA_EXTENSION1-FIELD3.

    MOVE COUNT TO WA_EXTENSION1-FIELD4. " Here COUNT indicates the line item because I am posting multiple docs

    APPEND WA_EXTENSION1 TO EXTENSION1.

    CLEAR: WA_EXTENSION1.

    What else should I write.Should I now also append The Tax Entries.

    Thanks In Advance,

    Regards,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bharti Jain,

      Yes still you can use the table EXTENSION1.

      but I suggest don't pass the value EBELN to the FIELD.

      You can use this FIELD1 as a identification field.

      Pass some text like "EBELN"(for the PO history), "WITHHOLDING TAX"(for withholding tax), this will help you in separating the records inside the User Exit.

      Inside the user exit you can read the table EXTENSION1 with key "FIELD1 = 'EBELN'" so that you can get the PO history related data. In the same way read the table EXTENSION1 with key "FIELD1= 'WITHHOLDING TAX'" so that you can get the Withholding related data and pass them in a corresponding structures.

      Regards

      Nivash S

  • author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2011 at 10:33 AM

    Thanks For Replying,

    But I have used COUNT as an important field because we are posting multiple documents and generating one voucher so it is necessary that which PO Number is attached with which document number. On the basis of COUNT ie Line Item I am able to put correct PO Number in the respective document.

    I am displaying an ALV grid with Checkbox so that user can select multiple Documents and that is why the COUNT field is required.

    Thanks & Regards,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2011 at 11:42 AM

    Should I write something else in place of COUNT.

    Regards,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2011 at 11:45 AM

    What are the fields that I should add in EXTENSION1 Table.

    Regards,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2011 at 03:44 AM

    Hi All The ABAP GURUS,

    I have appended the EXTENSION1 Table in the following manner.

    Field1 ---WITH_ITEM-WITHT

    Field2 ---WITH_ITEM-WT_WITHCD

    Field3 ---WITH_ITEM-WT_QSSHB

    Field4 ---Line Item

    Then in Interface I have appended all the fileds to the table ACCIT_WT from the EXTENSION1 Table . Is this correct . What are the filed related to Withholding Tax that I should update in another structure ACCIT & ACCIT_WT. Now also I have not got success.

    Thanks In Advance

    Regards,

    Bharti Jain

    Edited by: Bharti Jain on Mar 4, 2011 4:45 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 04, 2011 at 06:45 AM

    Not Yet Got the success.

    Please send the code from where the Tax is deducted with the BAPI_ACC_DOCUMENT_POST.

    Regards,

    Bharti Jain

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.