Application Development 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: 

BAPI_ACC_DOCUMENT_CHECK tax item BKPF-XMWST

MariusStoica
Active Participant
0 Kudos

Hi gurus,

I have an issue.

I'm using BAPI_ACC_DOCUMENT_CHECK, to verify a document before posting. The document needs to have the BKPF-XMWST filled with the value "X".

I've created 2 enhancements for both ACC_DOCUMENT and I added the code:

METHOD if_ex_acc_document~change.

       LOOP AT c_accit INTO wa_accit WHERE mwskz IS NOT INITIAL.

         wa_accit-xmwst = 'X'.

         MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING xmwst.

       ENDLOOP.

 

ENDMETHOD.


but the resulting document doesn't have the 3rd line (the tax item) and I get no error message (the document is created).


Is there something I'm missing or did I do something wrong?


Thanks,

Marius



1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

The tax items should be transfered to the BAPI manually, so probably that flag doesn't trigger the process to create the item automatically

Max

11 REPLIES 11

Former Member
0 Kudos

Hi

The tax items should be transfered to the BAPI manually, so probably that flag doesn't trigger the process to create the item automatically

Max

0 Kudos

Hi Max,

Found the problem.

The above code is still active.

Here is how my FI document should look like.

And the tables are like this:

2 line in  GL accounts 37102 and 37803

1 line in Account Tax 442802

3 lines in Currency amount

Here is the code to it:


ls_accountgl-itemno_acc   1.

ls_accountgl-gl_account   = '0037102000'.

ls_accountgl-de_cre_ind   = 'S'.

APPEND ls_accountgl TO lt_accountgl.

ls_accountgl-itemno_acc   2.

ls_accountgl-gl_account   = '0037803000'.

ls_accountgl-tax_code      = 'BA'.

ls_accountgl-de_cre_ind   = 'H'.

APPEND ls_accountgl TO lt_accountgl.

ls_accounttax-itemno_acc        = 3.

ls_accounttax-tax_code          = 'BA'.

ls_accounttax-gl_account       = '0044280200'.

ls_accounttax-acct_key          = 'MWS'.

ls_accounttax-cond_key          = 'MWAS'.

APPEND ls_accounttax TO lt_accounttax.


ls_currencyamount-itemno_acc    = 1.

ls_currencyamount-currency      = 'RON'.

ls_currencyamount-amt_doccur    = 1.24.

APPEND ls_currencyamount TO lt_currencyamount.

ls_currencyamount-itemno_acc    = 2.

ls_currencyamount-currency      = 'RON'.

ls_currencyamount-amt_doccur    = -1.

APPEND ls_currencyamount TO lt_currencyamount.

ls_currencyamount-itemno_acc    = 3.

ls_currencyamount-currency      = 'RON'.

ls_currencyamount-amt_doccur    = -0.24.

ls_currencyamount-amt_base      = -1.

APPEND ls_currencyamount TO lt_currencyamount.

Thanks,
Marius

0 Kudos

Yes

but it seems you've transfered the tax item manually, so enhancement should be useless

Max

0 Kudos

Indeed. I couldn't find a solution for it to do the calculus automatically

If you found one you can share it for the "others" .

Thanks Max.

Marius

0 Kudos

Hello Marius,

The FM CALCULATE_TAX_FROM_GROSSAMOUNT can be used to calcuate tax amounts.

Populate table accounttax  using tax calculated from above FM and pass it to BAPI BAPI_ACC_DOCUMENT_CHECK

Thanks

0 Kudos

No

I'm sorry as I've written in my first answer the tax item has to be calculated manually: this is my experience of course.

But if I'll find out some news I'll share them

Max

0 Kudos

I was talking about the "BKPF-XMWST" automation.

Indeed I used the functions to calculate the gross, net, tax values and I gave them to he BAPI.

0 Kudos

Hello Marius,

If your requirement is to update BKPF-XMWST then read return table of bapi and update BKPF table by using bukrs belnr and year.

Since there is no field for XMWST in DOCUMENTHEADER (BAPI).

Thanks

0 Kudos

Good

Infact the easier way to calculate the tax is to use function modules like CALCULATE_TAX_FROM_NET_AMOUNT or CALCULATE_TAX_FROM_GROSSAMOUNT

I believe there're several posts about that

Max

0 Kudos

Yes, there are.

Thanks Max.

0 Kudos

In case some wonders, here


ls_currencyamount-itemno_acc    = 3.

ls_currencyamount-currency      = 'RON'.

ls_currencyamount-amt_doccur    = -0.24.

ls_currencyamount-amt_base      = -1.

APPEND ls_currencyamount TO lt_currencyamount.

You can change the amt_base from "-1" (minus), to "1". Some FI detalis ... in my case it's what I had to do to make he document 100% FI proof