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: 

CALCULATE_TAX_ITEM' giving wrong results

Former Member
0 Kudos

Hi Experts,

I am using CALCULATE_TAX_ITEM' FM to get the Invoice tab tax details in Smartforms for printing Purchase Order.

When iam trying to see print preview, some time it is giving correct values and some times not.

I have used FM REFRESH_TAX_TABLES to refresh the tax Internal Table but still unable to get the correct values.

if i debug the form then its giving correct values and the same PO im executing directly its not giving correct value.

I have cleared all local variable, structures and internal tables.

Please let me know if anyone faced the same issue in smartforms,

Regards

SK

12 REPLIES 12

Former Member
0 Kudos

hi Shaik Basha

Please make sure dat u are using :

RV_PRICE_PRINT_ITEM' and 'J_1B_NF_PO_DISCOUNTS' prior to CALCULATE_TAX_ITEM' It makes the necessary arrangements regarding the Company code and other details .

Or you could refer the standard coding for the Calculation of Taxes for the line items it also usually follws the same sequesnce .

Hope it helps .

Regrards

Swapnil

0 Kudos

Hi Swapnil,

I have used RV_PRICE_PRINT_ITEM , J_1B_NF_PO_DISCOUNTS and FIND_TAX_SPREADSHEET FMs.

Thanks for your reply.

Former Member
0 Kudos

Hi,

U can get the conditon valuse using FM this will give give correct figures always. ( Make sure that Your conditions are not statistical).

wa_komp-kposn = wa-ebelp.

wa_komp-werks = wa-werks.

wa_komp-matnr = wa-matnr.

wa_komp-matkl = wa-matkl.

wa_komp-meins = wa-meins.

wa_komp-mglme = wa-menge.

wa_komp-wrbtr = wa-netwr.

wa_komp-mwskz = wa-mwskz.

wa_komp-mtart = wa-mtart.

wa_komk-txjcd = wa-txjcd.

wa_komk-mwskz = wa-mwskz.

wa_komk-mandt = ekko-mandt.

wa_komk-knumv = ekko-knumv.

wa_komk-aland = ekko-lands.

wa_komk-bukrs = ekko-bukrs.

wa_komk-hwaer = ekko-waers.

wa_komk-waerk = ekko-waers.

wa_komk-lifnr = ekko-lifnr.

IF ekko-bsart NE 'ZNB4'.

wa_komk-kappl = 'TX'.

ELSE.

wa_komk-kappl = 'M'.

ENDIF.

IF ekko-bsart NE 'ZNB4'.

wa_komk-kalsm = t005-kalsm.

ELSE.

wa_komk-kalsm = ekko-kalsm.

ENDIF.

wa_komk-prsdt = ekko-bedat.

wa_komk-ekorg = ekko-ekorg.

SELECT SINGLE j_1ichid

FROM j_1imtchid

INTO wa_komp-steuc

WHERE matnr = wa_komp-matnr

AND werks = wa_komp-werks.

CALL FUNCTION 'PRICING'

EXPORTING

calculation_type = 'B'

comm_head_i = wa_komk

comm_item_i = wa_komp

IMPORTING

comm_head_e = wa_komk

comm_item_e = wa_komp

TABLES

tkomv = i_komv.

0 Kudos

Hi All,

Please find my code below.

Please let me know anything missed while passing to FM's.

*&----


&

" Tax Calculation

CLEAR: t_taxcom.

t_taxcom-bukrs = zxekko-bukrs.

t_taxcom-budat = zxekko-bedat.

t_taxcom-waers = zxekko-waers.

t_taxcom-kposn = wa_ekpo-ebelp.

t_taxcom-mwskz = wa_ekpo-mwskz.

t_taxcom-shkzg = 'H'.

t_taxcom-xmwst = 'X'.

IF l_flag IS INITIAL.

t_taxcom-wrbtr = wa_ekpo-netwr.

ELSE.

t_taxcom-wrbtr = l_pbxx + l_zdis.

ENDIF.

t_taxcom-lifnr = zxekko-lifnr.

t_taxcom-land1 = zxekko-lands. "'IN'.

t_taxcom-ekorg = zxekko-ekorg.

t_taxcom-matnr = wa_ekpo-matnr.

t_taxcom-werks = wa_ekpo-werks.

t_taxcom-matkl = wa_ekpo-matkl.

t_taxcom-meins = wa_ekpo-meins.

t_taxcom-mglme = wa_ekpo-menge.

t_taxcom-mtart = wa_ekpo-mtart.

CALL FUNCTION 'REFRESH_TAX_TABLES'

EXCEPTIONS

OTHERS = 1.

CHECK sy-subrc EQ 0.

REFRESH i_taxes .

CLEAR i_taxes.

*&----


&

*TABLES: komk,komp,t001.

DATA: BEGIN OF tkomv OCCURS 50.

INCLUDE STRUCTURE komv.

DATA: END OF tkomv.

DATA: BEGIN OF tkomvd OCCURS 50.

INCLUDE STRUCTURE komvd.

DATA: END OF tkomvd.

DATA: t_konv TYPE TABLE OF komv WITH HEADER LINE.

CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'

TABLES

tkomv = tkomv.

CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'

EXPORTING

bukrs = wa_t001-bukrs

component = 'IN'.

komk-kalsm = zxekko-kalsm.

IF zxekko-kalsm = ''.

komk-kalsm = 'RM0000'.

ENDIF.

*komk-kappl = 'M'.

komk-waerk = zxekko-waers.

komk-knumv = zxekko-knumv.

komk-lifnr = zxekko-lifnr.

komp-kposn = wa_ekpo-ebelp.

komp-matnr = wa_ekpo-matnr.

komp-werks = wa_ekpo-werks.

komp-matkl = wa_ekpo-matkl.

komp-infnr = wa_ekpo-infnr.

komp-evrtn = wa_ekpo-konnr.

komp-evrtp = wa_ekpo-ktpnr.

komp-netwr = wa_ekpo-netwr.

komp-netpr = wa_ekpo-netpr.

komp-wrbtr = wa_ekpo-netwr.

komp-meins = wa_ekpo-meins.

komp-mglme = wa_ekpo-menge.

komp-mwskz = wa_ekpo-mwskz.

CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

EXPORTING

comm_head_i = komk

comm_item_i = komp

language = 'E'

TABLES

tkomv = tkomv

tkomvd = tkomvd.

CALL FUNCTION 'J_1B_NF_PO_DISCOUNTS'

EXPORTING

i_kalsm = zxekko-kalsm

i_ekpo = wa_ekpo

IMPORTING

e_ekpo = wa_ekpo

TABLES

i_konv = t_konv.

IF NOT zxekko-llief IS INITIAL.

t_taxcom-lifnr = zxekko-llief.

ENDIF.

CALL FUNCTION 'FIND_TAX_SPREADSHEET'

EXPORTING

buchungskreis = wa_t001-bukrs

EXCEPTIONS

not_found = 1

OTHERS = 2.

*&----


&

CALL FUNCTION 'CALCULATE_TAX_ITEM'

EXPORTING

i_taxcom = t_taxcom

  • IMPORTING

  • e_taxcom = t_taxcom

TABLES

t_xkomv = i_taxes.

0 Kudos

Hi Guys,

Any update on this?

Please let me know any parameter or FM is missing

0 Kudos

resolved my self

Former Member
0 Kudos

Hi,

You have to use these . It may slove your issue.

RV_PRICE_PRINT_ITEM

RV_PRICE_PRINT_HEAD

RV_PRICE_PRINT_REFRESH

Thanks.

Former Member
0 Kudos

resolved myself

0 Kudos

How did u resolve?? m having same issue...

0 Kudos

HI,

I have copied the standard FM (CALCULATE_TAX_ITEM) into ZFM and used the same.

Smartform will not get refresh when u use Cal_XX FM internally (no commit work) so we need to create Z and call the same in Forms.

Regards

SK

Former Member
0 Kudos

Hi Shaik,

I am stuck with the same issue can you please gimme the solution for FM CALCULATE_ITEM_TAX.

This function module is giving the wrong answer.

Have gone through the number of links but none of them gave the solution

Any help would be appreciable.

Thanks & Regards,

Akshay Ruia

0 Kudos

Hi,

I had the same issue, that taxes on invoice tab of PO was not printed correctly on PO form by calling CALCULATE_TAX_ITEM.

If you want to have the same tax value as komp-mwsbp, that use following form routine call before FB CALCULATE_TAX_ITEM.

perform j_1b_save_tax_fields(saplmepo) using ekko ekpo lfa1.

This is used in transaction me23n also.

Kind regards,

Tülay