12-07-2013 3:44 AM
12-07-2013 8:10 AM
Manoj pleade provide complete details of what you are looking for
12-07-2013 8:41 AM
I am creating Miro through BAPI_INCOMINGINVOICE_CREATE and what to calculate tax amout to pass into bapi but Qty received is more than GRN qty so how can i calculate Tax amount.
For egs
My GRN Qty is 50 MT amt 59850
i Have to Calculate Tax but I have to create Miro for Amt 59500
Hoe will i calculate
Regards,
Manoj
12-07-2013 10:07 AM
Hi Manoj,
Its confusing the requirement.
Is it really possible to create the invoice for more than received quantity? for example Vendor procured the 100 quantity to company and company paying the amount for 110 quantity. I guess it is the reverse way.
If you pass the below paramters, system will calculate the tax amount automatically.
headerdata-calc_tax_ind = 'X'.
itemdata-tax_code = EKPO-MWSKZ and
itemdata-quantity = GRQuantity-gmenge.
let me know you are looking in different way!
Thanks,
Kiran
12-09-2013 4:55 AM
Hi Kiran,
i Have to calculate tax amount for Excess Quanity
My net quantity is graeater than challan qty.
on which we have to calculate tax amount.
if i am doing manually miro it is calculating the tax correctly but
when i am calculation tax amount through function module calculate _tax_amount
it is calcuating wrong tax amt.
Thanks,
Manoj
12-09-2013 5:01 AM
Hi Manoj
As kiran correctly mentioned you need to pass those value as SAP will calculate it automatically
Nabheet
12-09-2013 5:17 AM
Hi kiran i have to pass the tax amount also
i will post my program
REFRESH: it_item.
******** Detail Data.
wa_item-invoice_doc_item = '000001'. " po SELECTION
wa_item-po_number = wa_final-ebeln. "PO number
wa_item-po_item = wa_final-ebelp. "PO item number
wa_item-ref_doc = wa_final-mblnr. "GR number
wa_item-ref_doc_year = wa_final-mjahr. "GR fiscal year
wa_item-ref_doc_it = wa_final-zeile. "GR item number
wa_item-item_amount = wa_final-amt. "Amount (MATERIAL DOC AMT)
wa_item-quantity = wa_final-qty. "Quantity
wa_item-po_unit = wa_final-meins. "UoM
wa_item-tax_code = wa_final-mwskz. "tax code applicable
APPEND wa_item TO it_item.
" header data
CLEAR : wa_header.
wa_header-invoice_ind = 'X'. " Invoice Selection
wa_header-doc_date = wa_final-cdate. " Document date
wa_header-pstng_date = sy-datum. " Posting date
wa_header-ref_doc_no = wa_final-cnumber. " Reference Document No.
wa_header-comp_code = '7000'. "gw_data-bukrs_i. " Company Code
wa_header-calc_tax_ind = 'X'.
wa_header-currency = 'INR'. "gw_data-waers_i. " Currency Type
wa_header-doc_type = 'RE'. "gw_data-blart. " Document Type
wa_header-header_txt = wa_final-cnumber.
wa_header-del_costs_taxc = wa_item-tax_code. " Tax Code
wa_header-housebankid = 'ICI01'.
* wa_header-item_text = 'CEMENT PPC'.
wa_header-business_place = 'BP70'.
wa_header-zzsecco = 'BP70'.
tax
CALL FUNCTION 'CALCULATE_TAX_ITEM'
EXPORTING
i_taxcom = i_taxcom
IMPORTING
e_taxcom = i_taxcom
TABLES
t_xkomv = t_konv
EXCEPTIONS
mwskz_not_defined = 1
mwskz_not_found = 2
mwskz_not_valid = 3
steuerbetrag_falsch = 4
country_not_found = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_header-gross_amount = i_taxcom-wmwst + wa_item-item_amount. "Gross amount(aft. tax) for the invoice
CLEAR: g_invno,g_fyear.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
headerdata = wa_header
IMPORTING
invoicedocnumber = g_invno
fiscalyear = g_fyear
TABLES
itemdata = it_item
glaccountdata = it_gl
materialdata = it_mat
* taxdata = it_tax
return = it_ret.
IF g_invno IS NOT INITIAL.
wa_error-miro_no = g_invno.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = it_ret.
endif.
12-09-2013 5:19 AM
Hi Manoj
I dont think their is any need to calculate tax. It will get calculated automaticvally. If you do same posting in MIRO it calculates for you right..? Same this BAPI will do
Nabheet
12-09-2013 5:52 AM
bapi is giveing below error.
Balance not zero: 68,971.06- debits: 68,971.06 credits: 0.00
12-09-2013 5:53 AM
12-09-2013 6:55 AM
12-19-2013 5:56 AM
Can u help in this
Calculate_tax_amount giving wrong value
as i have pass parameters and calculated tax through FM
and by manualy doing miro and calculating tax are not matched
please provide solution
12-19-2013 6:45 AM
Hi Manoj,
Please provide me the details of CALL FUNCTION 'CALCULATE_TAX_ITEM'. what kind of tax code you are passing and its calculation.
What tax amount is returning from the FM and how much you are expecting.
12-20-2013 3:01 AM
TABLES : ekko , ekpo , t001 , komk , komp ,lfa1.
DATA mwsbp TYPE komp-mwsbp .
DATA:t_konv TYPE TABLE OF komv ."OF TY_KONV,
DATA:tkomv TYPE TABLE OF komv_tab ."OF TY_KONV,
PARAMETERS : p_ebeln TYPE ekpo-ebeln ,
p_ebelp TYPE ekpo-ebelp .
START-OF-SELECTION .
PERFORM calculate_tax USING p_ebeln p_ebelp CHANGING mwsbp .
WRITE mwsbp .
FORM calculate_tax USING p_ebeln TYPE ekpo-ebeln
p_ebelp TYPE ekpo-ebelp
CHANGING p_mwsbp TYPE komp-mwsbp .
CONSTANTS: bstyp-info VALUE 'I',
bstyp-ordr VALUE 'W',
bstyp-banf VALUE 'B',
bstyp-best VALUE 'F',
bstyp-anfr VALUE 'A',
bstyp-kont VALUE 'K',
bstyp-lfpl VALUE 'L',
bstyp-lerf VALUE 'Q'.
DATA : taxcom TYPE taxcom ,
t_konv TYPE TABLE OF komv WITH HEADER LINE .
DATA: BEGIN OF tkomv OCCURS 50.
INCLUDE STRUCTURE komv.
DATA: END OF tkomv.
DATA: BEGIN OF tkomvd OCCURS 50. "Belegkonditionen
INCLUDE STRUCTURE komvd.
DATA: END OF tkomvd.
DATA : BEGIN OF tkomvh OCCURS 50.
INCLUDE STRUCTURE komv.
DATA : vtext LIKE t685t-vtext.
DATA : END OF tkomvh.
* call FUNCTION 'REFRESH_TAX_TABLES'
* EXCEPTIONS
* OTHERS = 1.
* CHECK sy-subrc EQ 0.
* REFRESH t_konv.
* CLEAR t_konv.
SELECT SINGLE *
INTO ekko
FROM ekko
WHERE ebeln = p_ebeln .
SELECT SINGLE *
INTO ekpo
FROM ekpo
WHERE ebeln = p_ebeln
AND ebelp = p_ebelp .
SELECT SINGLE *
INTO t001
FROM t001
WHERE bukrs = ekko-bukrs .
SELECT SINGLE * FROM lfa1 INTO lfa1
WHERE lifnr = ekko-lifnr.
CALL FUNCTION 'ZCALCULATE_TAX'
EXPORTING
i_ekko = ekko
i_ekpo = ekpo
i_lfa1 = lfa1
TABLES
t_komv = t_konv.
taxcom-bukrs = ekpo-bukrs.
taxcom-budat = ekko-bedat.
taxcom-waers = ekko-waers.
taxcom-kposn = ekpo-ebelp.
taxcom-mwskz = ekpo-mwskz.
taxcom-txjcd = ekpo-txjcd.
taxcom-shkzg = 'H'.
taxcom-xmwst = 'X'.
IF ekko-bstyp EQ bstyp-best.
taxcom-wrbtr = ekpo-netwr.
ELSE.
taxcom-wrbtr = ekpo-zwert.
ENDIF.
taxcom-lifnr = ekko-lifnr.
taxcom-land1 = ekko-lands.
taxcom-ekorg = ekko-ekorg.
taxcom-hwaer = t001-waers.
taxcom-llief = ekko-llief.
taxcom-bldat = ekko-bedat.
taxcom-matnr = ekpo-ematn.
taxcom-werks = ekpo-werks.
taxcom-bwtar = ekpo-bwtar.
taxcom-matkl = ekpo-matkl.
taxcom-meins = ekpo-meins.
IF ekko-bstyp EQ bstyp-best.
taxcom-mglme = ekpo-menge.
ELSE.
IF ekko-bstyp EQ bstyp-kont AND ekpo-abmng GT 0.
taxcom-mglme = ekpo-abmng.
ELSE.
taxcom-mglme = ekpo-ktmng.
ENDIF.
ENDIF.
IF taxcom-mglme EQ 0.
taxcom-mglme = 1000.
ENDIF.
taxcom-mtart = ekpo-mtart.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'J_1BSA_COMPONENT_ACTIVE'
EXPORTING
bukrs = ekko-bukrs
component = 'BR'
EXCEPTIONS
component_not_active = 1
OTHERS = 2.
IF sy-subrc IS INITIAL.
komk-mandt = ekko-mandt.
komk-kalsm = ekko-kalsm.
IF ekko-kalsm = ''.
komk-kalsm = 'RM0000'.
ENDIF.
komk-kappl = 'M'.
komk-waerk = ekko-waers.
komk-knumv = ekko-knumv.
komk-lifnr = ekko-lifnr.
komp-kposn = ekpo-ebelp.
komp-matnr = ekpo-matnr.
komp-werks = ekpo-werks.
komp-matkl = ekpo-matkl.
komp-infnr = ekpo-infnr.
komp-evrtn = ekpo-konnr.
komp-evrtp = ekpo-ktpnr.
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 = ekko-kalsm
i_ekpo = ekpo
IMPORTING
e_ekpo = ekpo
TABLES
i_konv = t_konv.
IF NOT ekko-llief IS INITIAL.
taxcom-lifnr = ekko-llief.
ENDIF.
ENDIF.
CALL FUNCTION 'FIND_TAX_SPREADSHEET'
EXPORTING
buchungskreis = t001-bukrs
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'CALCULATE_TAX_ITEM'
EXPORTING
i_taxcom = taxcom
IMPORTING
e_taxcom = taxcom
TABLES
t_xkomv = t_konv
EXCEPTIONS
mwskz_not_defined = 1
mwskz_not_found = 2
mwskz_not_valid = 3
steuerbetrag_falsch = 4
country_not_found = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
amount is 60600 and qty is 30.300
I am getting tax as 10894.67
and if i calculate tax amount from miro tcode
i am getting 10893.57
can help ....
p_mwsbp = taxcom-wmwst .