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: 

Reg Tax Details getting from Me22n tcode

former_member198892
Participant
0 Kudos

Dear All,

I need to fetch all the tax details from Service PO. In service PO they r not maintain Material code, I tried this code, this PRICING FM is not fetching the tax value..

DATA: it_komv LIKE komv OCCURS 0 WITH HEADER LINE,

l_ekpo LIKE ekpo.

TABLES: ekko,taxcom,komp,komk,komv,t001,t005,t007a.

SELECT SINGLE * FROM ekpo INTO l_ekpo

WHERE ebeln = is_ekpo-ebeln

AND ebelp = is_ekpo-ebelp.

CHECK NOT l_ekpo-mwskz IS INITIAL.

SELECT SINGLE * FROM t001 WHERE bukrs = is_ekpo-bukrs.

SELECT SINGLE * FROM t005 WHERE land1 = t001-land1.

SELECT SINGLE * FROM ekko WHERE ebeln = is_ekpo-ebeln.

*BREAK-POINT.

IF l_ekpo-mwskz NE space.

CLEAR taxcom.

taxcom-bukrs = l_ekpo-bukrs.

taxcom-budat = ekko-bedat.

taxcom-waers = ekko-waers.

taxcom-kposn = l_ekpo-ebelp.

taxcom-mwskz = l_ekpo-mwskz.

taxcom-txjcd = l_ekpo-txjcd.

taxcom-ebeln = l_ekpo-ebeln.

taxcom-ebelp = l_ekpo-ebelp.

taxcom-shkzg = 'H'.

taxcom-xmwst = 'X'.

IF ekko-bstyp EQ 'F'.

taxcom-wrbtr = l_ekpo-netwr.

ELSE.

taxcom-wrbtr = l_ekpo-zwert.

ENDIF.

  • - beginn neue felder zu 3.0c für internationale steuermodule

taxcom-lifnr = ekko-lifnr.

taxcom-land1 = t001-land1.

taxcom-land1 = ekko-lands. "WIA

taxcom-ekorg = ekko-ekorg.

taxcom-gsber = l_ekpo-ko_gsber. "noch nicht versorgt bei uns

taxcom-hwaer = t001-waers.

taxcom-llief = ekko-llief.

taxcom-bldat = ekko-bedat.

taxcom-matnr = l_ekpo-ematn.

taxcom-matnr = l_ekpo-matnr. "HTN-Abwicklung

taxcom-werks = l_ekpo-werks.

taxcom-bwtar = l_ekpo-bwtar.

taxcom-matkl = l_ekpo-matkl.

taxcom-meins = l_ekpo-meins.

ENDIF.

IF ekko-bstyp EQ 'F'.

taxcom-mglme = l_ekpo-menge.

ELSE.

IF ekko-bstyp EQ 'K' AND l_ekpo-abmng GT 0.

taxcom-mglme = l_ekpo-abmng.

ELSE.

taxcom-mglme = l_ekpo-ktmng.

ENDIF.

ENDIF.

IF taxcom-mglme EQ 0. "falls keine Menge gesetzt --> auf 1 setzen

taxcom-mglme = 1000. "z.B. bestellte Banf nochmal bestellt

ENDIF.

taxcom-mtart = l_ekpo-mtart.

IF NOT ekko-llief IS INITIAL.

taxcom-lifnr = ekko-llief.

ENDIF.

CALL FUNCTION 'J_1BSA_COMPONENT_CHECK'

EXPORTING

component = 'IN'

EXCEPTIONS

component_not_installed = 1

OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION 'SAP_TO_ISO_COUNTRY_CODE'

EXPORTING

sap_code = t001-land1

IMPORTING

iso_code = t005-intca

EXCEPTIONS

not_found = 1

no_iso_code = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

CLEAR komk.

komk-mandt = sy-mandt.

komk-kappl = 'TX'.

komk-waerk = taxcom-waers.

komk-aland = taxcom-land1.

komk-mwskz = taxcom-mwskz.

komk-kunnr = taxcom-kunnr.

komk-lifnr = taxcom-lifnr.

komk-llief = taxcom-llief.

komk-ekorg = taxcom-ekorg.

komk-gsber = taxcom-gsber.

komk-bukrs = t001-bukrs.

komk-hwaer = t001-waers.

komk-kalsm = t005-kalsm.

IF komk-aland IS INITIAL.

komk-aland = t001-land1.

ENDIF.

IF t001-xstdt = 'X' AND NOT taxcom-bldat IS INITIAL.

komk-prsdt = taxcom-bldat.

ELSE.

komk-prsdt = taxcom-budat.

ENDIF.

CLEAR komp. " HCG

komp-kposn = taxcom-kposn.

komp-mwskz = taxcom-mwskz.

komp-kzinc = space.

komp-matnr = taxcom-matnr.

komp-werks = taxcom-werks.

komp-bwtar = taxcom-bwtar.

komp-matkl = taxcom-matkl.

komp-meins = taxcom-meins.

komp-mglme = taxcom-mglme.

komp-mtart = taxcom-mtart.

komp-evrtn = taxcom-ebeln.

komp-evrtp = taxcom-ebelp.

komk-projk = taxcom-projk.

komp-prctr = taxcom-prctr.

komk-aufnr = taxcom-aufnr.

komk-kostl = taxcom-kostl.

komk-kokrs = taxcom-kokrs.

komk-blart = taxcom-blart.

*BREAK-POINT.

*------- mwskz prüfen -


*

CALL FUNCTION 'TAX_INDICATOR_CHECK'

EXPORTING

steuerschema = t005-kalsm

steuerkennzeichen = taxcom-mwskz

IMPORTING

t007a = t007a.

*------- us-taxes ? -


*

IF t005-kalsm NE space.

komk-txjcd = taxcom-txjcd.

ELSE.

taxcom-txjcd = space.

ENDIF.

komp-wrbtr = taxcom-wrbtr.

CALL FUNCTION 'PRICING'

EXPORTING

comm_head_i = komk

comm_item_i = komp

calculation_type = 'B'

IMPORTING

comm_head_e = komk

comm_item_e = komp

TABLES

tkomv = it_komv.

*BREAK-POINT.

*CLEAR : v_tax, v_vat, v_cst.

BREAK-POINT.

LOOP AT it_komv.

CASE it_komv-kschl.

WHEN 'ZMO1' OR 'ZMO2' OR 'VEXC'. " Excise

IF NOT it_komv-kbetr IS INITIAL .

IF it_komv-kposn NE 0.

  • MOVE it_komv-kwert TO v_exc .

  • ADD it_komv-kwert TO tot_exc .

ENDIF.

ENDIF .

WHEN 'JECE' OR 'ZECS' OR 'VECS' OR 'JEC2'. " EDU Cess

IF NOT it_komv-kbetr IS INITIAL

AND NOT it_komv-kwert IS INITIAL .

IF it_komv-kposn NE 0.

  • MOVE it_komv-kwert TO v_ces .

  • ADD it_komv-kwert TO tot_ces .

ENDIF.

ENDIF .

WHEN 'JIP6' OR 'JIP2' OR 'JIP4' OR 'JIP7' OR 'JEXS'. " VAT

IF NOT it_komv-kbetr IS INITIAL .

  • CLEAR v_vat.

  • MOVE it_komv-kwert TO v_vat .

  • ADD it_komv-kwert TO tot_vat .

ENDIF .

WHEN 'JIP5' OR 'JIP1'. " CST

IF NOT it_komv-kbetr IS INITIAL .

  • MOVE it_komv-kwert TO v_cst.

  • ADD it_komv-kwert TO tot_cst .

ENDIF .

ENDCASE .

  • v_tax = v_vat + v_cst.

ENDLOOP.

Instead of material code which one i have pass in KOMK and KOMP Structue..Please sugest me.

Regards,

Thanuskodi T.

1 REPLY 1

Former Member
0 Kudos

Hi

Take the EKKO (po Header) KNUMV field and pass it to KONV-KNUMV and get the condition type based amounts (KBETR and KWERT) from table KONV

Regards

Anji