BAPI_ACC_DOCUMENT_POST tax line items issue

Hi All,
i am posting a document using BAPI_ACC_DOCUMENT_POST...
Please find the below code:
Populate BAPI item structures
FORM fill_bapi_item .
*Local data declarations
  DATA : lv_taxded TYPE bset-fwste,
         lv_taxtot TYPE bset-fwste,
         lv_amt    TYPE wrbtr,
         lv_ref2   TYPE xref2,
         ls_mwdat  TYPE rtax1u15,
         lt_mwdat  TYPE TABLE OF rtax1u15.
Tax juris code for vendor
  IF gs_item1-koart = gc_v.  " vendor
    gv_tjxcd = gs_item1-txjcd.
  ENDIF.
  gv_item = gv_item + 1.
Concatenate the legacy number, store and division and pass it
to field XREF2 of the BAPI
  CLEAR lv_ref2.
  CONCATENATE gs_item1-legacy gs_item1-divsn gs_item1-store
  INTO lv_ref2.
Fill the GL account structure if the account type is G
otherwise fill the Vendor structure.
  IF gs_item-koart = gc_g
  OR gs_item-koart = space.  " For offset clearing account
    gs_accountgl-itemno_acc  = gv_item.
    gs_accountgl-gl_account  = gs_item1-newko.
    gs_accountgl-de_cre_ind  = gs_item1-shkzg.
    gs_accountgl-item_text   = gs_item1-sgtxt.
    gs_accountgl-comp_code   = gs_item1-newbk  .
    gs_accountgl-tax_code    = gs_item1-mwskz.
    gs_accountgl-taxjurcode  = gv_tjxcd.
    gs_accountgl-alloc_nmbr  = gs_item1-zuonr.
    gs_accountgl-ref_key_1   = gs_item1-xref1.
    gs_accountgl-ref_key_2   = lv_ref2. " legacy accountstoredivision
    gs_accountgl-profit_ctr  = gs_item1-prctr.
    gs_accountgl-costcenter  = gs_item1-kostl.
    APPEND gs_accountgl TO gt_accountgl.
    CLEAR gs_accountgl.
    CLEAR : lv_taxded, lv_taxtot , lv_amt , ls_mwdat.
    REFRESH : lt_mwdat.
Fetch the tax amount based on the gross amount, tax code and juris code
    CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'
      EXPORTING
        i_bukrs                 = gs_header1-bukrs
        i_mwskz                 = gs_item1-mwskz
        i_txjcd                 = gv_tjxcd
        i_waers                 = gs_header1-waers
        i_wrbtr                 = gs_item1-wrbtr
      IMPORTING
        e_fwste                 = lv_taxtot
        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
        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 NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
Calculate the amounts.
      lv_amt = gs_item-wrbtr - lv_taxded.  " Tax deductable.
Get the GL Account, Condition,etc. for TAX amount
      READ TABLE lt_mwdat INTO ls_mwdat INDEX 1.
      IF sy-subrc EQ 0.
    Do Nothing
      ENDIF.
Fill the currency structures for GL Account
      gs_curr-itemno_acc = gv_item.
      gs_curr-amt_doccur = lv_amt.           " Net amount after tax
      gs_curr-currency   = gs_header1-waers. " Currency is at header
      APPEND gs_curr TO gt_curr.
      CLEAR : gs_curr.
Fill the tax structure for GL Account.
      gv_item = gv_item + 1.
      gs_tax-itemno_acc = gv_item.
      gs_tax-gl_account = ls_mwdat-hkont.
      gs_tax-cond_key   = ls_mwdat-kschl.
      gs_tax-acct_key   = ls_mwdat-ktosl.
      gs_tax-tax_code   = gs_item1-mwskz.
      gs_tax-taxjurcode = ls_mwdat-txjcd.
      gs_tax-taxjurcode_deep   = ls_mwdat-txjcd_deep.
      gs_tax-taxjurcode_level  = ls_mwdat-txjlv.
      APPEND gs_tax TO gt_tax.
      CLEAR gt_tax.
Fill the TAX amount in the currency structure.
      gs_curr-itemno_acc = gv_item.
      gs_curr-amt_base   = lv_taxded.        " Tax
      gs_curr-currency   = gs_header1-waers. " Currency is at header
      APPEND gs_curr TO gt_curr.
      CLEAR : gs_curr.
    ENDIF.
Vendor
  ELSEIF gs_item-koart = gc_v.
    gs_vendor-itemno_acc  = gv_item.
    gs_vendor-gl_account  = gs_item1-newko.
    gs_vendor-item_text   = gs_item1-sgtxt.
    gs_vendor-comp_code   = gs_item1-newbk.
    gs_vendor-tax_code    = gs_item1-mwskz.
    gs_vendor-taxjurcode  = gv_tjxcd.
    gs_vendor-alloc_nmbr  = gs_item1-zuonr.
    gs_vendor-ref_key_1   = gs_item1-xref1.
    gs_vendor-ref_key_2   = lv_ref2.  " legacy accountstoredivision
    gs_vendor-profit_ctr  = gs_item1-prctr.
    APPEND gs_vendor TO gt_vendor.
    CLEAR gs_vendor.
Fill the currency structures for vendor(No Tax calculation here)
    gs_curr-itemno_acc = gv_item.
    gs_curr-amt_doccur = gs_item1-wrbtr.
    gs_curr-currency   = gs_header1-waers. " Currency is at header
    APPEND gs_curr TO gt_curr.
    CLEAR : gs_curr.
  ENDIF.
ENDFORM.                    " FILL_BAPI_ITEM
But if i post using FB01 and give the tax amount and gross amount, there are 6 items for tax getting created....(sum of 6 items = tax amoutn passed)...
But when i create using BAPI, one taxx item is created but with total tax amount...
How to achieve the same way as in FB01(6 items or so)..
Thanks
Shiva

Can you try and use 'CALCULATE_TAX_FROM_NET_AMOUNT' instead of the one you are using and see if you are getting 6 entries?
In this the tax lines come as an internal table. This is the same FM that SAP uses to derive the tax lines within the standard transaction. Please let me know if this was helpful.
Thanks and Regards,
Hari

Similar Messages

  • MIRO tax line item Issue

    Dear All,
    When I post a MIRO having more than one line item, I am not able to find a material in the Material field in BSEG table for my MIRO Accounting document.
    Note that I am using 4.7 version & for tax item entry's since the material is not captured in the std. BSEG table I am unable to get how much is the Sales/Service tax Payed against each item/Material.
    Kindly suggest Is this anything to do with my SAP version??
    or Is there anyway to make my material appear in the std. BSEG table??
    Regards,

    Hi,
    Do anyone have an idea on this Issue?
    Plz help.
    Regards,

  • Substitution of Business Area for Tax Line Items for Invoices posted in MM

    Hi
    We have one Business Area for every company code. A substitution rule has been created to populate Business Area in Tax Line Items, while booking vendor invoice. The substitution rule has been defined as
    Prerequite
    Company Code = 1234 and GL = 1323232
    Substitution
    Business Area = 6668
    The system is working fine, when the Vendor Invoice is posted through FI. However, when the vendor invoice is generated through MIRO or MIR7, the Business Area is not substituted.
    In Table VWTYGB01, we have maintained BSEG-GSBER as a field allowed for substitution with Boolean Class 09.
    We have created the susbstitution rule for Text and Assignment also and the rules are working fine for all document posted through FI and MM
    Regards
    Sanil
    Sanil K Bhandari

    Hi
    Business Area is a sensitive field, agreed. However, the substitution rule is working fine for FI posted documents and the issue is in MM generated documents.
    Regards
    Sanil Bhandari

  • Tax Line item

    Hi Gurus,
    I have been trying to create a Vendor Invoice (FB60) & in the line item I have assigned a Input Tax Code. However, the tax line item that should have been created automatically, is not getting generated.
    Once I find out the Tax Account for that Tax Code & manually enter the 'tax line item' & try to simulate, I get a message that "Enter the Tax Base Amounts for Account _____ in company code _____.
    I am at a loss as to,
    Firstly, why is the Tax Line item not getting created automatically?
    Secondly, when I manually enter the Tax Line Item, what does the error I am getting mean & how do I deal with it?
    Gurus, please help me.
    Thanks in advance.
    Regards,
    Debojit Dey

    Hi Debojit,
    Pl. check this config step. Check whether you have selected vaues in the field <b>Posting Indicatior</b> for the Account Key you have created for the tax type.
    The vaues are as under:
    Pstng ind. Short text                                                                               
    1              No posting required                         
    2              Separate line item                          
    3              Distribute to relevant expense/revenue items
    Path: <b>Financial Accounting> Tax on Sales/Purchases> Basic Settings> Check and Change Settings for Tax Processing</b>-   Select you account key and enter the vales in the field <b>Posting Indicatior</b>. 
    Hope this will solve your issue.
    Regards,
    Vijay.

  • Withholding tax line items are not post

    Hi,
    I was configured all the steps for extended withholding tax up to Assign withholding tax to vendor master data
    and the i am used to post an vendor invoice
    given all required feild and press enrer and display the withhoding tax codes screen here also press enter button ....  i entered all required field and go to simulation this posting i am getting only 2 line items
    like for eg: --- Inventory Debit ,   Vendor Credit  only
    here my problem is i am not getting the all with holding tax line items
    please hepl
    Sree

    Dear Sree,
    if You defined the WT type at the payment time, the WT line items will be created at the payment time and not during the invoice posting.
    Please check.
    Mauri

  • Tax line items when travel expenses are posted to intercompany

    Hello Experts,
    We are posting a expense report  to a different cost center other than the Master cost center(IT0001). In this case system understanding as intercompany transaction and posting the travel expenses to different cost center and different company code. But the problem is when there is a tax calcualted, this tax is initially getting posted to original master cost center and again transfering the taxes to the intercompany cost center. this is creating an additional FI documents and also additional tax line items which is becoming very difficult for reconcilation.
    can any one suggest me where could be the correction required in order to post the taxes to intercompany cost center in the first instance itself.
    Thanks&Regards
    Srinivas

    Hi Srinivas,
    Profit center was not picking for tax line item when we were doing multiple cost center in a TRIP. So we have activated "not deductible" in VST and it got worked.
    Later when we got a Cross company employee vendor posting, tax line items are posting in both company codes.
    So we have deactivated "not deductible" in VST and activated "set expense company code" in table T706K (to allow cross company code postings in TM)
    And defined a new solution in New GL config for the first prblem.
    We have not changed anything in "posting indicator" in OBCN, it was 2 (Separate line item) only. You should not change this.
    All postings went fine.
    Regards
    SM

  • Business Area postings in Tax line items

    Hi Experts,
    As we know that Business Area is not updated in the tax line items, In one our company code we have done BA adjustment through F.5D and F.5E in 2007, after that there are thousands of line items in the system without business areas, now my client wants a tallied business area trial balance from 2007 onwards or aleast to ensure that the tax line items should get business area assignments from hereafter,  and also recently we have created one more company code, Please help how do I ensure that all the tax line items and items with blank business areas get the business area postings. Is there any user exit or any work around available for this... At present we have only one GL for Inter business area clearing for all types of accounts (reconciliation, tax accounts) in OBXM.
    Please help...
    Regards,
    Khan

    Hello,
    Are NewGL and document splitting active in your system? If yes, you should solve this problem with using splitting function.
    Otherwise, you can use business transaction event 00001120.
    I explained step by step how can you activate BTE 00001120. I give you message below.
    Re: FBCJ - Cash Journal Transaction
    In this exit, you must update t_bsegsub-gsber field which t_bseg-buzid = 'T' for tax item.
    But you can not split tax line items in this exit. For example in invoice you have 2 or more business area, but tax line item doesn't create for each buiness area (If you don't use document splitting functon). So in this exit you can only assign a business area to tax line item which is automatically generate while posting FI document.
    Regards,
    Burak

  • Substitution for MIRO Business Area for tax line items

    Hi All,
    Our business requirement is updation of BA in tax line items during MIRO transaction. To fulfill this requirement i have written a substitution with user exit. Business user enters BA in bktxt . In user exit iam passing bktxt field to bseg-gsber. But BA is not updating in tax line items. Here iam giving the code which i have written in my user exit. Pls guide me what to do aprt from this.
      IF bkpf-bktxt IS NOT INITIAL.
        t_gsber = bkpf-bktxt.
      ENDIF.
      IF bseg-hkont EQ '0000098511' OR bseg-hkont EQ '0000098521' OR bseg-hkont EQ '0000098583'.
        cobl-gsber = t_gsber.
      ENDIF.
      IF bseg-hkont EQ '0000098511' OR bseg-hkont EQ '0000098521' OR bseg-hkont EQ '0000098583'.
        bseg-gsber = t_gsber.
      ENDIF.

    update like below:-
    UPDATE dbtab FROM TABLE itab. or
    UPDATE (dbtabname) FROM TABLE itab.

  • Business area not defaulted for tax line item

    Hello Friends,
    I am posting Customer invoice, when I simulate the invoice that time Output tax is automatically calculating the tax. My problem is, in the Output tax line item business area is required field which is appearing in display mode.
    T code - OBXM. Here we will configure this and at the month end we will run the following transactions.
    F.5D, F.5E.
    I want to know step by step cinformation for this. If you have any documentation send it to [email protected]
    Rams.N
    Points will be assigned for the right answer

    hi,
    If you are using business area method then you want to create all sales tax GL with business area optional. And You create one GL like Tax clearing account(business area optional)and assign the same in OBXM against all the sales tax GLs.
    Then you want to run F.5d and F.5e on everymonth.
    govind.

  • Get Withholding Tax Line Item Using FM

    Hi all,
    Is the any FM that allows me to get withholding tax line item (in table WITH_ITEM) based on the line item in BSEG? What I want from the result is that it will be able to tell me which line item in WITH_ITEM belongs to which line item in BSEG.
    Thanks for helping out.
    Regards,
    Goh Tiam Tjai

    Hello,
    I've found a way to do it, and considering that I could not find the answer in SCN I'll post it.
    I've created a report to show the calculated WHT which would be posted only at the payment moment. Also, in Brazil we work with extended WHT (and not the classic one).
    You will need an ABAP.
    Create a Z function module as copy of ZFI_WT_FB05_CALCULATE_WT.
    This FM has only input parameters, therefore it does not provide you with the calculated WHT as an output (as standard). Knowing this, it is necessary to change it (the FM) by summing all T_WITH_ITEM-WT_QBSHH per accounting document (this table is present in the standard FM).
    You need to provide the logic in order to obtain the parameters, The field which need to be filled are:
    I_AKTYP              =             "H”
    I_DYNCL              =             "Z”
    Table I_POSTAB
    Pick the data below from BKPF/BSEG of the accounting document which needs WHT to be calculated:
    BELNR 
    BUKRS
    GJAHR
    BUZEI
    WAERS
    BUDAT
    BLDAT
    BSCHL
    KOART
    SHKZG
    DMBTR
    WRBTR
    KONKO
    XAKTP = "X"
    XAKTS = "X"
    Table  I_BKPF
    BUKRS
    GJAHR     = year of the system date
    BLART     = KZ
    BLDAT     = system date
    BUDAT     = system date
    MONAT     = period of the system date
    TCODE     = FBZ2
    WAERS
    Then after changing the FM to have T_WITH_ITEM-WT_QBSHH as output, simulate it by inserting the values of the accounting document which has WHT, and check the result, if it is the same as calculated by F-53 or F110.

  • WH  tax line items cleared along with Other line items Message no:8I701

    hI guru,
    When i run J1INCHLN  System givem the error is : Withholding tax line items cleared along with other line items, message no:8I701
    Pleas any one give solution ..
    I also cheked as respective g/l for tds IN FBL3N . All line items are opend.
    Also cheked all selection parameter in J1INCHLN  and FBL3N .is same .
    Why the sys behaviour like this .
    Thanks is andvance
    Milind

    HI,
    he error is occuring in this part of the
    unction Module J_1IEWT_CHALLAN_UPDATE
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    LOOP AT p_t_ausz1.
    Select the cleared line item from bseg table.
       SELECT SINGLE * FROM bseg INTO  p_bseg_tab
                WHERE bukrs = p_t_ausz1-bukrs
                AND   belnr = p_t_ausz1-belnr
                AND   gjahr = p_t_ausz1-gjahr
                AND   buzei = p_t_ausz1-buzei
                AND   ktosl = 'WIT'
                AND   qsskz NE space .
       IF sy-subrc <> 0.
    This is not an ewt clearing transaction relevant for challan update.
         p_no_with_clear = 'X'.
         EXIT.
       ELSE.
         APPEND p_bseg_tab.
       ENDIF.
    ENDLOOP.
    Even if one line item chosen is not of withholding tax entry, system
    should exit by error message.
    DESCRIBE TABLE p_bseg_tab LINES  p_bseg_lines.
    DESCRIBE TABLE p_t_ausz1  LINES  p_with_lines.
       IF p_bseg_lines > 0.
    At least one entry is found in bseg table for challan update.    IF p_with_lines NE p_bseg_lines.
    At least one line chosen by the user is not for challan updation.
          MESSAGE e701(8i).
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
    This is a clear case,that you are trying to post some documents
    which does not match with the selection parameters.
    I feel the above problem could be due to some document/s (open items of
    the earlier years)are incorrect which is causing the reported problem.
    Kindly run the challan update program for smaller date range so that you
    can find the faulty document.
    Hope this solves your query.
    Reg
    Madhu M

  • Document should not splitt to tax line items

    Hi,
    Document should not splitt for tax line items,currently it is happining how contol this.
    Thanks and Reg

    Hi,
    Then in the document splitting configuration, you can remove the base item category for this TAx Item Category.
    Regards,
    SDNer

  • Enhancement for tax line items to post Business area level

    Hi Gurus,
    My Client has Business area at state wise. he wants to state wise Tax reports.
    Can any one help me how to post tax line items at Business area level.
    Please help me if any one know how to do Enhancement on this.
    Appreaciate your great help.
    Regards,
    Ashok

    Hi Gurus,
    Please help on above post.
    Regards,
    Ashok

  • Tax line items in MIRO

    Dear Friends
    When we are doing MIRO, number of tax line items are created in a document for each material line item. How to get total tax in one tine item.
    Thanks & Regards

    Hi
    I would not recommend to use work-around if you do this there will so many scenarios will come into picture with each unique tax code. I think it is advisable to stick with SAP standard but still you want to try some work around then I following may or may not helpful
    LMR1M002 Account grouping for GR/IR account determination
    BAdI for saving an invoice document (INVOICE_UPDATE)
    Thanks,
    Jagdeep

  • Assignment field in tax line item

    Hi
    Withholding tax rates are maintanted in vendor master data. So while making entry vis fb60 it automatically posts to the TDS as per rate maintained. My problem is in line item for this kind of tax, which causes problem in document posting. Error log says that these tax line item need to be corrected.
    When i give some input in "assignment" field then only it allows to post. 
    Could you tell me where this "assignment" field is maintained as mandatory for posting?
    Thanks
    Sweta

    Hi Sweta,
    Use OBC4 and change from mandatory to optional the assignment number in respect of field status group (I suppose G001) which has been mentioned in respect of that GL Account which is meant for TDS.  This should solve your problem.
    Aravind Boddupalli

Maybe you are looking for

  • How to delete free goods created in MBN1?

    I dont want the free goods to be automatically populated in ME21N anymore, so which t-code to delete the free goods? Thank you. VT

  • May we have CC on two of my computers within one subscribtion ?

    I have full CC subscribtion and I have Creative CLoud application on two machines as I was instructed by Adobe agent it should be all right. Now it gives me error message and indicates that it is a third machine with my  id - while I have given away

  • CPO WSDL File location

    I recently had a request about the physical location of the web/appserver that services web requests on a CPO box. Do you know what the phyical location where the things that service something like http://<CPO Server>/WS/process?wsdl would be located

  • Apple T.V. Reomote Big Problem

    So, I lost my apple TV remote so I bought a new one. its wasn't synced so I needed to get to the settings to do that but i cant. I thought I could get around this by using the Remote app on my iPhone but the apple TV screen is stuck at the "update" o

  • No SID for info object....

    Hi All, No SID found for value 10 for 0currency. error group: RFC_ERROR_SYSTEM_FAILURE Can you please help me to resolve on this issue. Appriciate your help!! Zen