<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: make BAPI_ACC_DOCUMENT_POST calculate tax. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386044#M813021</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Florian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it won't make, you have to calculate tax on your own before the BAPI call and fill the ACCOUNTTAX parameter (tables) accordingly. For each line, which represents a line for VAT, you need a line in table ACCOUNTTAX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Feb 2008 14:47:33 GMT</pubDate>
    <dc:creator>JozsefSzikszai</dc:creator>
    <dc:date>2008-02-25T14:47:33Z</dc:date>
    <item>
      <title>make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386041#M813018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, when using TA FB01, there is a checkbox "calculate tax".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i´m using the BAPI_ACC_DOCUMENT_POST. and i cant find anything correspondant here.&lt;/P&gt;&lt;P&gt;Any ideas, hints, workarounds?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 11:47:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386041#M813018</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T11:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386042#M813019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will help you,.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI_ACC_GL_POSTING_CHECK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'BAPI_ACC_GL_POSTING_CHECK'
EXPORTING
documentheader = w_documentheader
TABLES
accountgl = it_accountgl
currencyamount = it_currencyamount
return = it_return.
 
Populate the corresponding tables with the data you have.
For the Date do convert it.
PERFORM convert_date USING it_header-bldat
CHANGING w_documentheader-doc_date.
 
w_documentheader-comp_code = 'z998'
w_documentheader-doc_type = 'SA'
"and fill the respective tables this way .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;BAPI_ACC_GL_POSTING_POST&lt;/P&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
call function 'BAPI_ACC_GL_POSTING_POST'
exporting
documentheader = doc_header
IMPORTING
OBJ_TYPE = l_objtype
* OBJ_KEY =
* OBJ_SYS =
tables
accountgl = t_accountgl
currencyamount = t_curramt
return = t_return
* EXTENSION1 =
.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 25, 2008 9:32 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 11:59:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386042#M813019</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T11:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386043#M813020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use 'CALCULATE_TAX_FROM_NET_AMOUNT' to calculate the taxes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subba&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 14:28:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386043#M813020</guid>
      <dc:creator>vsubbakrishna</dc:creator>
      <dc:date>2008-02-25T14:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386044#M813021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Florian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it won't make, you have to calculate tax on your own before the BAPI call and fill the ACCOUNTTAX parameter (tables) accordingly. For each line, which represents a line for VAT, you need a line in table ACCOUNTTAX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 14:47:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386044#M813021</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-02-25T14:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386045#M813022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OMG thanks a lot, who could have guessed that i have to take action myself &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now it works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 14:52:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386045#M813022</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T14:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386046#M813023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how did you take care of the tax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the same and in 2 different ways, one is system calculating tax and the other is manually sending the tax amount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also want the calculate tax checkbox checked on the screen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 15:34:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386046#M813023</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-26T15:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386047#M813024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Florian,&lt;/P&gt;&lt;P&gt;we also facing the same problem.with the above solution, we tried by passing to table accounttax.getting message documnet posted with key.but i couldn't find the entry in table with that key.are the tables bkpf &amp;amp; bseg where it stores in case of account tax also?&lt;/P&gt;&lt;P&gt;cau send me the code which you have tried for the succes post with tax item and so flag was set.&lt;/P&gt;&lt;P&gt;Its so urgent for us.Please help us.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;salini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 13:54:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386047#M813024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T13:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386048#M813025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
PERFORM build_documentheader
     USING        ls_data
     CHANGING ls_documentheader.

PERFORM build_documentpositions
    TABLES   lt_currencyamount
                   lt_accountgl
                   lt_accounttax
     USING    ls_data.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
            EXPORTING
              documentheader = ls_documentheader
            TABLES
              accountgl      = lt_accountgl
              currencyamount = lt_currencyamount
              accounttax     = lt_accounttax
              return         = lt_return.

NOW the code for the routines:

FORM build_documentheader
  USING    ls_data           LIKE LINE OF gt_data
  CHANGING ls_documentheader TYPE bapiache09.


  ls_documentheader-bus_act     = 'RFBU'.
  ls_documentheader-username    = sy-uname.
  ls_documentheader-pstng_date  = ls_cpudt.
  ls_documentheader-header_txt  = 'Vertreterprovision'.
  ls_documentheader-comp_code   = ls_data-vkorg.
  ls_documentheader-doc_date    = sy-datum.
  ls_documentheader-doc_type    = 'DG'.


ENDFORM.

FORM build_documentpositions
  TABLES   lt_currencyamount    TYPE tt_currencyamount
           lt_accountgl         TYPE tt_acountlg
           lt_accounttax        TYPE tt_accounttax
  USING    ls_data              LIKE LINE OF gt_data.

  DATA:    ls_accountgl         LIKE LINE OF lt_accountgl,
           ls_currencyamount    LIKE LINE OF lt_currencyamount,
           ls_accounttax        LIKE LINE OF lt_accounttax,
           ls_vbrp              TYPE vbrp.

  DATA:    lv_debitor           TYPE kunnr,
           lv_akont             TYPE knb1-akont,
           lv_swap_vbeln        TYPE char20,
           lv_swap_posnr        TYPE char20,
           lv_swap_vbelv        TYPE char20,
           lv_swap_posnv        TYPE char20,
           lv_swap_vtrnr        TYPE char20,
           lv_lkz               TYPE adrc-country,
           lv_land              TYPE t005t-landx,
           lv_tax_code          TYPE c LENGTH 2,
           lv_tax_rate          TYPE fwste.


  CLEAR: lt_currencyamount, lt_accountgl.

  SELECT SINGLE aubel aupos vbelv posnv prctr  "ermittle Auftrag zur Faktura
  FROM   vbrp
  INTO   CORRESPONDING FIELDS OF ls_vbrp
  WHERE  vbeln = ls_data-vbeln
  AND    posnr = ls_data-posnr.


  SELECT SINGLE akont
  FROM   knb1
  INTO   lv_akont
  WHERE  kunnr = ls_data-vtrnr
  AND    bukrs = ls_data-bukrs.


*
* 04.02.2008 FIS/pb
* Korrektur : Land steht schon in der KNA1
*

  SELECT SINGLE land1
  FROM   kna1
  INTO   lv_lkz
  WHERE  kunnr = ls_data-vtrnr.

*  break fis-kemmer.

  IF ls_data-vtrnr EQ '0000900021' OR ls_data-vtrnr EQ '0000900008'.
    lv_tax_code = '46'.
    ls_accounttax-itemno_acc = '03'.
    ls_accounttax-tax_code   = lv_tax_code.
    ls_accounttax-gl_account   = '0000263110'.
    ls_accounttax-direct_tax = 'X'.
    ls_accounttax-cond_key    = 'MWVS'.
    ls_accounttax-acct_key    = 'VST'.
    APPEND ls_accounttax TO lt_accounttax.
    CLEAR  ls_accounttax.
    ls_currencyamount-amt_base = ls_data-prov.
  ELSE.
    CASE lv_lkz.
      WHEN 'DE'.
        lv_tax_code = 'V1'.
      WHEN OTHERS.
        lv_tax_code = 'U7'.
    ENDCASE.
  ENDIF.

  ls_accountgl-itemno_acc = '01'.
  ls_accountgl-gl_account = lv_akont.
  ls_accountgl-tax_code   = lv_tax_code.
  ls_accountgl-customer   = ls_data-vtrnr.
  ls_accountgl-acct_type  = 'D'.

  WRITE ls_data-vbeln TO lv_swap_vbeln LEFT-JUSTIFIED NO-ZERO.
  WRITE ls_data-posnr TO lv_swap_posnr LEFT-JUSTIFIED NO-ZERO.
  WRITE ls_data-vtrnr TO lv_swap_vtrnr LEFT-JUSTIFIED NO-ZERO.
  WRITE ls_vbrp-vbelv TO lv_swap_vbelv LEFT-JUSTIFIED NO-ZERO.
  WRITE ls_vbrp-posnv TO lv_swap_posnv LEFT-JUSTIFIED NO-ZERO.

  CONDENSE: lv_swap_vbeln, lv_swap_posnr, lv_swap_vtrnr, lv_swap_vbelv, lv_swap_posnv.

  CONCATENATE lv_swap_vbeln ';'
              lv_swap_posnr ';'
              lv_swap_vtrnr ';'
              lv_swap_vbelv ';'
              lv_swap_posnv ';'
              ls_data-name1
  INTO ls_accountgl-item_text.

  APPEND ls_accountgl TO lt_accountgl.
  CLEAR  ls_accountgl.

  ls_currencyamount-itemno_acc = '01'.
  ls_currencyamount-curr_type  = '00'.
  ls_currencyamount-currency   = ls_data-waers.
  ls_currencyamount-amt_doccur = ls_data-prov * -1.

  APPEND ls_currencyamount TO lt_currencyamount.
  CLEAR ls_currencyamount.

  ls_accountgl-itemno_acc = '02'.
  ls_accountgl-gl_account = p_konto.
  ls_accountgl-tax_code   = lv_tax_code.
  CONCATENATE ls_data-vbeln ls_data-posnr INTO ls_accountgl-item_text.
  ls_accountgl-profit_ctr = ls_vbrp-prctr.
  ls_accountgl-sales_ord  = ls_vbrp-vbelv.
  ls_accountgl-s_ord_item = ls_vbrp-posnv.

  APPEND ls_accountgl TO lt_accountgl.
  CLEAR  ls_accountgl.

  CALL FUNCTION 'RECP_FI_TAX_CALCULATE'
    EXPORTING
      ic_bukrs    = '1000'
      ic_mwskz    = lv_tax_code
      ic_waers    = 'EUR'
    IMPORTING
      ep_tax_rate = lv_tax_rate
    EXCEPTIONS
      not_found   = 1
      OTHERS      = 2.

  IF sy-subrc &amp;lt;&amp;gt; 0.

  ENDIF.

  ls_currencyamount-itemno_acc = '02'.
  ls_currencyamount-curr_type  = '00'.
  ls_currencyamount-currency   = ls_data-waers.
  ls_currencyamount-amt_doccur = ls_data-prov - ( ls_data-prov / 100 * lv_tax_rate ).

  APPEND ls_currencyamount TO lt_currencyamount.
  CLEAR ls_currencyamount.

  IF ls_data-vtrnr EQ '0000900021' OR ls_data-vtrnr EQ '0000900008'.
    ls_currencyamount-itemno_acc = '03'.
    ls_currencyamount-curr_type  = '00'.
    ls_currencyamount-currency   = ls_data-waers.
    ls_currencyamount-amt_base   = ls_data-prov .
    ls_currencyamount-amt_doccur = ls_data-prov / 100 * lv_tax_rate.

    APPEND ls_currencyamount TO lt_currencyamount.
    CLEAR  ls_currencyamount.
  ENDIF.
ENDFORM. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 14:02:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386048#M813025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T14:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386049#M813026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;we also facing the same problem. we tried by passing to table accounttax.getting message documnet posted with key.but icouldn't find the entry in table with that key.are the tables bkpf &amp;amp; bseg where it stores in case of account tax also?&lt;/P&gt;&lt;P&gt;cau send me the code which you have tried for the succes post with tax item and so flag was set.&lt;/P&gt;&lt;P&gt;Its so urgent for us.Please help us.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;salini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 14:38:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386049#M813026</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T14:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386050#M813027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply.can you check the following code and.its returning me the doc no but no doc posted in bkpf &amp;amp; bseg tables.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;wa_documentheader-username   = im_header-zz_req_by.&lt;/P&gt;&lt;P&gt;  wa_documentheader-header_txt = im_header-bktxt.&lt;/P&gt;&lt;P&gt;  wa_documentheader-comp_code  = im_header-zz_charg_bukrs.&lt;/P&gt;&lt;P&gt;  wa_documentheader-doc_date   = sy-datum.&lt;/P&gt;&lt;P&gt;  wa_documentheader-pstng_date = sy-datum.&lt;/P&gt;&lt;P&gt;  wa_documentheader-doc_type   = im_header-blart.&lt;/P&gt;&lt;P&gt;  wa_documentheader-bus_act    = 'RFBU'.&lt;/P&gt;&lt;P&gt;  wa_documentheader-ref_doc_no = 'testing'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;fill GL (line 1)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  tb_accountgl-itemno_acc     = 1.&lt;/P&gt;&lt;P&gt;  tb_accountgl-comp_code      = im_header-zz_charg_bukrs.&lt;/P&gt;&lt;P&gt;  tb_accountgl-gl_account     = '0000800000'.&lt;/P&gt;&lt;P&gt;  tb_accountgl-item_text      = '#630020$5109669400\5109673020'.&lt;/P&gt;&lt;P&gt;  tb_accountgl-costcenter     = '1101810007'.&lt;/P&gt;&lt;P&gt;  tb_accountgl-tax_code       = 'P1'.&lt;/P&gt;&lt;P&gt;  APPEND tb_accountgl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  tb_currencyamount-itemno_acc   = 1.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-curr_type = '00'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-currency     = 'AUD'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-amt_doccur   = '150.00'.&lt;/P&gt;&lt;P&gt;  APPEND tb_currencyamount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tb_accountgl-itemno_acc     = 2.&lt;/P&gt;&lt;P&gt;  tb_accountgl-comp_code      = im_header-zz_charg_bukrs.&lt;/P&gt;&lt;P&gt;  tb_accountgl-gl_account     =  '0000121710'.&lt;/P&gt;&lt;P&gt;    TB_ACCOUNTGL-ITEM_TEXT      = '#630020$5109669400\5109673020'.&lt;/P&gt;&lt;P&gt;  APPEND tb_accountgl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  tb_currencyamount-itemno_acc   = 2.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-curr_type = '00'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-currency     = 'AUD'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-amt_doccur   = '-125.00'.&lt;/P&gt;&lt;P&gt;  APPEND tb_currencyamount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  tb_accounttax-itemno_acc   = 3.&lt;/P&gt;&lt;P&gt;  tb_accounttax-gl_account   = '0000121710'.&lt;/P&gt;&lt;P&gt;  tb_accounttax-tax_code   = 'P1'.&lt;/P&gt;&lt;P&gt;tb_accounttax-TAX_RATE  = '20'.&lt;/P&gt;&lt;P&gt;  APPEND tb_accounttax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  tb_currencyamount-itemno_acc   = 3.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-curr_type = '00'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-currency     = 'AUD'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-amt_doccur   = '-25.00'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-tax_amt = '-25.00'.&lt;/P&gt;&lt;P&gt;  tb_currencyamount-amt_base     = '-125.00'.&lt;/P&gt;&lt;P&gt;  APPEND tb_currencyamount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      documentheader    = wa_documentheader&lt;/P&gt;&lt;P&gt;      customercpd       = wa_customercpd&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      obj_type          = wf_obj_type&lt;/P&gt;&lt;P&gt;      obj_key           = wf_obj_key&lt;/P&gt;&lt;P&gt;      obj_sys           = wf_obj_sys&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      accountgl         = tb_accountgl&lt;/P&gt;&lt;P&gt;      accountreceivable = tb_accountreceivable&lt;/P&gt;&lt;P&gt;      accountpayable    = tb_accountpayable&lt;/P&gt;&lt;P&gt;      accounttax        = tb_accounttax&lt;/P&gt;&lt;P&gt;      currencyamount    = tb_currencyamount&lt;/P&gt;&lt;P&gt;      criteria          = tb_criteria&lt;/P&gt;&lt;P&gt;      valuefield        = tb_valuefield&lt;/P&gt;&lt;P&gt;      extension1        = tb_extension1&lt;/P&gt;&lt;P&gt;      return            = tb_return&lt;/P&gt;&lt;P&gt;      paymentcard       = tb_paymentcard&lt;/P&gt;&lt;P&gt;      contractitem      = tb_contractitem&lt;/P&gt;&lt;P&gt;      extension2        = tb_extension2&lt;/P&gt;&lt;P&gt;      realestate        = tb_realestate.&lt;/P&gt;&lt;P&gt;  READ TABLE tb_return INDEX 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sucessfull posting&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF tb_return-type = 'S'.&lt;/P&gt;&lt;P&gt;    wa_fi_docno = tb_return-message_v2.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        wait   = 'X'&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        return = tb_return.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 16:10:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386050#M813027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T16:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: make BAPI_ACC_DOCUMENT_POST calculate tax.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386051#M813028</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;it is important ACCOUNTTAX table. if your taxcode  is provide taxamount with out zero. .you can use below code. in lt_tax has different item(position) number than currency amount.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2231161-image.png" /&gt;&lt;/P&gt;&lt;P&gt;position number is important here. split item one two items. position 5 is tax.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2231162-image.png" /&gt;&lt;/P&gt;&lt;P&gt;This gl_account is coming from calculate_tax method..&lt;/P&gt;&lt;P&gt;you must only give tax_code if really calculated .  &lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2231163-image.png" /&gt;&lt;/P&gt;&lt;P&gt;DATA : ls_dochead TYPE bapiache09,&lt;BR /&gt;         lt_curr    TYPE STANDARD TABLE OF bapiaccr09,&lt;BR /&gt;         ls_curr    TYPE  bapiaccr09,&lt;BR /&gt;         lt_acgl    TYPE STANDARD TABLE OF  bapiacgl09,&lt;BR /&gt;         ls_acgl    TYPE  bapiacgl09,&lt;BR /&gt;         ls_zaccit  TYPE zaccextension2,&lt;BR /&gt;         lt_ext2    TYPE STANDARD TABLE OF  bapiparex,&lt;BR /&gt;         ls_ext2    TYPE  bapiparex,&lt;BR /&gt;         lt_tax     TYPE STANDARD TABLE OF  bapiactx09,&lt;BR /&gt;         ls_tax     TYPE bapiactx09.&lt;BR /&gt;  DATA : lv_line TYPE i.&lt;BR /&gt;  "ls_dochead-obj_type = 'BKPF'.&lt;BR /&gt;  ls_dochead-username = sy-uname.&lt;BR /&gt;  ls_dochead-header_txt =  af_sgtxt.&lt;BR /&gt;  ls_dochead-comp_code = af_bukrs.&lt;BR /&gt;  ls_dochead-fisc_year = af_budat(4).&lt;BR /&gt;  ls_dochead-fis_period = af_budat+4(2).&lt;BR /&gt;  ls_dochead-doc_date = af_budat.&lt;BR /&gt;  ls_dochead-pstng_date = af_bldat.&lt;BR /&gt;  ls_dochead-trans_date = af_bldat.&lt;BR /&gt;  ls_dochead-doc_type = 'SA'.&lt;BR /&gt;  ls_dochead-ref_doc_no = af_xblnr.&lt;BR /&gt;  lv_line  = lines( at_data ).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  LOOP AT at_data INTO DATA(ls_data).&lt;BR /&gt;    ls_acgl-itemno_acc = sy-tabix .&lt;BR /&gt;&lt;BR /&gt;    ls_acgl-gl_account = |{ ls_data-hkont ALPHA = IN }|.&lt;BR /&gt;    ls_acgl-item_text = ls_data-sgtxt.&lt;BR /&gt;&lt;BR /&gt;    ls_acgl-ref_key_1 = ls_data-ref_key_1.&lt;BR /&gt;&lt;BR /&gt;    ls_acgl-doc_type = 'SA'.&lt;BR /&gt;    ls_acgl-comp_code = af_bukrs.&lt;BR /&gt;    ls_acgl-func_area_long = ls_data-func_area.&lt;BR /&gt;    ls_acgl-fis_period = af_budat+4(2).&lt;BR /&gt;    ls_acgl-fisc_year = af_budat(4).&lt;BR /&gt;    ls_acgl-pstng_date = ls_dochead-pstng_date.&lt;BR /&gt;    ls_acgl-value_date = ls_dochead-pstng_date.&lt;BR /&gt;    ls_acgl-costcenter = |{  ls_data-kostl  ALPHA = IN }|..&lt;BR /&gt;    ls_acgl-profit_ctr = ls_data-prctr.&lt;BR /&gt;    ls_acgl-orderid = |{ ls_data-orderid ALPHA = IN }|.&lt;BR /&gt;    ls_acgl-sales_ord = |{ ls_data-sales_ord ALPHA = IN }|.&lt;BR /&gt;    ls_acgl-s_ord_item = |{ ls_data-s_ord_item ALPHA = IN }|.&lt;BR /&gt;    ls_acgl-wbs_element = ls_data-wbs_element.&lt;BR /&gt;    ls_acgl-tax_code = ls_data-tax_code.&lt;BR /&gt;    ls_acgl-taxjurcode = ls_data-taxjurcode.&lt;BR /&gt;    ls_acgl-segment = ls_data-segment.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;    ls_curr-itemno_acc = ls_acgl-itemno_acc.&lt;BR /&gt;    ls_curr-currency = af_waers.&lt;BR /&gt;&lt;BR /&gt;    CASE ls_data-shkzg.&lt;BR /&gt;&lt;BR /&gt;      WHEN 'H'.&lt;BR /&gt;        ls_curr-amt_doccur = ls_data-amt_doccur * -1.&lt;BR /&gt;&lt;BR /&gt;      WHEN 'S'.&lt;BR /&gt;        DATA : lv_wrbtr TYPE wrbtr .&lt;BR /&gt;        lv_wrbtr =   ls_data-amt_doccur  .&lt;BR /&gt;        DATA(ls_ctax) =  calculate_tax(&lt;BR /&gt;            EXPORTING&lt;BR /&gt;              i_wrbtr =   lv_wrbtr&lt;BR /&gt;              i_mwskz =    ls_data-tax_code " Tax on sales/purchases code&lt;BR /&gt;                 ).&lt;BR /&gt;        IF ls_ctax-kawrt NE lv_wrbtr.&lt;BR /&gt;          ls_curr-amt_doccur = ls_ctax-kawrt.&lt;BR /&gt;          ls_curr-amt_base = ls_data-amt_doccur.&lt;BR /&gt;          ls_tax-itemno_acc = ls_acgl-itemno_acc + lv_line.&lt;BR /&gt;          ls_tax-gl_account = ls_ctax-hkont.&lt;BR /&gt;          ls_tax-tax_code = ls_data-tax_code.&lt;BR /&gt;&lt;BR /&gt;        ELSE.&lt;BR /&gt;          ls_curr-amt_doccur = ls_data-amt_doccur .&lt;BR /&gt;        ENDIF.&lt;BR /&gt;&lt;BR /&gt;    ENDCASE.&lt;BR /&gt;&lt;BR /&gt;    IF ls_data-gac NE space.&lt;BR /&gt;      ls_zaccit-posnr = ls_acgl-itemno_acc .&lt;BR /&gt;      ls_zaccit-zzgac = ls_data-gac.&lt;BR /&gt;      ls_ext2-structure = 'ZACCEXTENSION2'.&lt;BR /&gt;      ls_ext2-valuepart1 = ls_zaccit.&lt;BR /&gt;      APPEND ls_ext2 TO lt_ext2.&lt;BR /&gt;&lt;BR /&gt;    ENDIF.&lt;BR /&gt;&lt;BR /&gt;    APPEND ls_acgl TO lt_acgl.&lt;BR /&gt;    APPEND ls_curr TO lt_curr.&lt;BR /&gt;&lt;BR /&gt;    IF ls_tax-itemno_acc IS NOT INITIAL.&lt;BR /&gt;      APPEND ls_tax TO lt_tax.&lt;BR /&gt;      ls_curr-amt_doccur = ls_ctax-wmwst.&lt;BR /&gt;      ls_curr-itemno_acc  = ls_acgl-itemno_acc + lv_line .&lt;BR /&gt;      APPEND ls_curr TO lt_curr.&lt;BR /&gt;    ENDIF.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;    CLEAR : ls_tax , ls_curr , ls_ext2, ls_acgl.&lt;BR /&gt;  ENDLOOP.&lt;BR /&gt;&lt;BR /&gt;CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'&lt;BR /&gt;  EXPORTING&lt;BR /&gt;    documentheader          =   ls_dochead&lt;BR /&gt;*   CUSTOMERCPD             =&lt;BR /&gt;*   CONTRACTHEADER          =&lt;BR /&gt;  tables&lt;BR /&gt;    ACCOUNTGL               = lt_acgl&lt;BR /&gt;*   ACCOUNTRECEIVABLE       =&lt;BR /&gt;*   ACCOUNTPAYABLE          =&lt;BR /&gt;    ACCOUNTTAX              = lt_tax&lt;BR /&gt;    CURRENCYAMOUNT          = lt_curr&lt;BR /&gt;*   CRITERIA                =&lt;BR /&gt;*   VALUEFIELD              =&lt;BR /&gt;*   EXTENSION1              =&lt;BR /&gt;    return                  = et_messages&lt;BR /&gt;*   PAYMENTCARD             =&lt;BR /&gt;*   CONTRACTITEM            =&lt;BR /&gt;    EXTENSION2              = lt_ext2&lt;BR /&gt;*   REALESTATE              =&lt;/P&gt;&lt;P&gt;*   ACCOUNTWT               =&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;*value( I_WRBTR )	TYPE WRBTR	Amount in Document Currency&lt;/P&gt;&lt;P&gt;*value( I_MWSKZ )	TYPE MWSKZ	Tax on sales/purchases code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*value( E_TAX )	TYPE RTAX1U15	Tax Rate and Tax Amount for a Tax Code&lt;/P&gt;  method CALCULATE_TAX.&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;    DATA : LT_MWDAT TYPE STANDARD TABLE OF RTAX1U15.&lt;BR /&gt;&lt;BR /&gt;    CALL FUNCTION 'CALCULATE_TAX_FROM_GROSSAMOUNT'&lt;BR /&gt;      EXPORTING&lt;BR /&gt;        i_bukrs                       = af_bukrs&lt;BR /&gt;        i_mwskz                       = I_MWSKZ&lt;BR /&gt;*       I_TXJCD                       = ' '&lt;BR /&gt;        i_waers                       = af_waers&lt;BR /&gt;        i_wrbtr                       = I_WRBTR&lt;BR /&gt;&lt;EM&gt; &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; &lt;/EM&gt;&lt;BR /&gt;     TABLES&lt;BR /&gt;       T_MWDAT                       = LT_MWDAT&lt;BR /&gt;     EXCEPTIONS&lt;BR /&gt;       BUKRS_NOT_FOUND               = 1&lt;BR /&gt;       COUNTRY_NOT_FOUND             = 2&lt;BR /&gt;       MWSKZ_NOT_DEFINED             = 3&lt;BR /&gt;       MWSKZ_NOT_VALID               = 4&lt;BR /&gt;       ACCOUNT_NOT_FOUND             = 5&lt;BR /&gt;       DIFFERENT_DISCOUNT_BASE       = 6&lt;BR /&gt;       DIFFERENT_TAX_BASE            = 7&lt;BR /&gt;       TXJCD_NOT_VALID               = 8&lt;BR /&gt;       NOT_FOUND                     = 9&lt;BR /&gt;       KTOSL_NOT_FOUND               = 10&lt;BR /&gt;       KALSM_NOT_FOUND               = 11&lt;BR /&gt;       PARAMETER_ERROR               = 12&lt;BR /&gt;       KNUMH_NOT_FOUND               = 13&lt;BR /&gt;       KSCHL_NOT_FOUND               = 14&lt;BR /&gt;       UNKNOWN_ERROR                 = 15&lt;BR /&gt;       OTHERS                        = 16&lt;BR /&gt;              .&lt;BR /&gt;    IF sy-subrc = 0.&lt;BR /&gt;       READ TABLE LT_MWDAT  INTO E_TAX   INDEX 1.&lt;BR /&gt;    ENDIF.&lt;BR /&gt;&lt;BR /&gt;  endmethod.&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best wishes&lt;/P&gt;&lt;P&gt;Erol ÇAĞLAR&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 11:56:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/make-bapi-acc-document-post-calculate-tax/m-p/3386051#M813028</guid>
      <dc:creator>Erol_CAGLAR</dc:creator>
      <dc:date>2023-12-26T11:56:48Z</dc:date>
    </item>
  </channel>
</rss>

