Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2801

My po calculation for smartform is not matching multiple line items po of me23n.

$
0
0

hii experts,

 

i am little bit stuck in a small situation here,the purchase order calculation for taxes + condition value is not coming accurate for my smartform calculation. pls refer the snippet below and just tell where i am deviating.

 

FORM calculate_tax.
DATA: my_taxcom TYPE j_1b_taxcom ,
l_taxcom 
TYPE taxcom ,
l_wa_t001   
TYPE t001,
e_taxcom 
TYPE taxcom ,
l_wa_komv
TYPE komv ,
l_gv_amount
TYPE netwr ,
l_unitprice
TYPE netwr,
l_ipiamount
TYPE netwr,
l_total_ipi
TYPE netwr,
l_total 
TYPE netwr  ,
l_taxamount
TYPE netwr.

SELECT SINGLE * FROM t001
INTO l_wa_t001
WHERE bukrs EQ 'KBEL'."it_ekko-bukrs.
*  READ TABLE it_ekpo INTO wa_ekpo WITH KEY ebeln = wa_ekko-ebeln.
LOOP AT it_ekpo INTO wa_ekpo WHERE ebeln = wa_ekko-ebeln.


* Fill tax fields relevant for PO
my_taxcom
-txreg_sf = wa_lfa1-txjcd.
my_taxcom
-txreg_st = wa_ekpo-txjcd.
my_taxcom
-taxbs    = wa_lfa1-taxbs.
my_taxcom
-ipisp    = wa_lfa1-ipisp.
my_taxcom
-brsch    = wa_lfa1-brsch.
my_taxcom
-mtuse    = wa_ekpo-j_1bmatuse.
my_taxcom
-mtorg    = wa_ekpo-j_1bmatorg.
my_taxcom
-ownpr    = wa_ekpo-j_1bownpro.
my_taxcom
-steuc    = wa_ekpo-j_1bnbm.
my_taxcom
-matkl    = wa_ekpo-matkl.
my_taxcom
-vrkme    = wa_ekpo-meins.
my_taxcom
-mgame    = wa_ekpo-menge.

my_taxcom
-loc_se = wa_lfa1-txjcd.
my_taxcom
-loc_sr = wa_lfa1-txjcd.

my_taxcom
-loc_pr   = wa_lfa1-txjcd.



*Populate fields based on country
CALL FUNCTION 'J_1B_SAVE_TAX_FIELDS'
EXPORTING
i_taxcom
= my_taxcom.

CLEAR l_taxcom.
l_taxcom
-bukrs = wa_ekpo-bukrs.
l_taxcom
-budat = wa_ekko-bedat.
l_taxcom
-waers = wa_ekko-waers.
l_taxcom
-kposn = wa_ekpo-ebelp.
l_taxcom
-mwskz = wa_ekpo-mwskz.
l_taxcom
-txjcd = wa_ekpo-txjcd.
l_taxcom
-shkzg = 'H'.
l_taxcom
-xmwst = 'X'.
IF wa_ekko-bstyp EQ 'F'.
l_taxcom
-wrbtr = wa_ekpo-netwr.
ELSE.
l_taxcom
-wrbtr = wa_ekpo-zwert.
ENDIF.
l_taxcom
-lifnr = wa_ekko-lifnr.
l_taxcom
-land1 = wa_ekko-lands. "WIA
l_taxcom
-ekorg = wa_ekko-ekorg.
l_taxcom
-hwaer = l_wa_t001-waers.
l_taxcom
-llief = wa_ekko-llief.
l_taxcom
-bldat = wa_ekko-bedat.
l_taxcom
-matnr = wa_ekpo-matnr. "HTN-Abwicklung
l_taxcom
-werks = wa_ekpo-werks.
l_taxcom
-bwtar = wa_ekpo-bwtar.
l_taxcom
-matkl = wa_ekpo-matkl.
l_taxcom
-meins = wa_ekpo-meins.
IF wa_ekko-bstyp EQ 'F'.
l_taxcom
-mglme = wa_ekpo-menge.
ELSE.
IF wa_ekko-bstyp EQ 'K' AND wa_ekpo-abmng GT 0.
l_taxcom
-mglme = wa_ekpo-abmng.
ELSE.
l_taxcom
-mglme = wa_ekpo-ktmng.
ENDIF.
ENDIF.
IF l_taxcom-mglme EQ 0.
l_taxcom
-mglme = 1000.
ENDIF.
l_taxcom
-mtart = wa_ekpo-mtart.

*Calculation of TAX

CALL FUNCTION 'CALCULATE_TAX_ITEM'
EXPORTING
dialog       = ' '
display_only
= ' '
i_taxcom    
= l_taxcom
IMPORTING
e_taxcom    
= e_taxcom
TABLES
t_xkomv     
= t_komv.

ENDLOOP.
ENDFORM.                    "calculate_tax_new

 

 

FORM po_value .
DATA: kbtr TYPE kwert.
data :kbtr1 type kwert.
data :kbtr2 type kbetr.
*--------------------------------------------------------------------*
"change by delta-abap
DATA : flag1(2) TYPE c.
LOOP AT t_komv WHERE mwsk1 <> ''.
wa_komv
-kposn = t_komv-kposn.
*wa_komv-mwsk1 = t_komv-mwsk1.
wa_komv
-kwert = t_komv-kwert.
*  IF t_komv-kschl = 'JIPS'.
* kbtr2 = ( t_komv-kbetr ) / 10.
*   ENDIF.

*   Added for  tax code X5 bsc
IF  t_komv-kschl = 'JIPC' or t_komv-kschl = 'JMOP' or  t_komv-kschl = 'JEC1' OR t_komv-kschl = 'JA1S'
and ( t_komv-mwsk1 = 'X5' ) .
kbtr2
= ( t_komv-kbetr ) / 10.
ENDIF.

*   Added for  tax code X6 bsc
IF t_komv-kschl = 'JMOP' OR t_komv-kschl = 'JEC1' AND ( t_komv-mwsk1 = 'X6' ).
kbtr2
= ( t_komv-kbetr ) / 10.
ENDIF.


COLLECT wa_komv INTO it_komv.
CLEAR wa_komv.
ENDLOOP.
CLEAR amount1.
*IF w_konv-kschl = 'JIPS'.
* kbtr2 = t_komv-kbetr.
*   ENDIF.

*--------------------------------------------------------------------*
"Change on 16/01/2014
" Specify the conditions in loop
LOOP AT t_konv INTO w_konv

CLEAR t_komv.
AT NEW kposn.
CLEAR flag1.

ENDAT.
flag1
= flag1  +  1.
READ TABLE t_komv WITH KEY mwsk1 = w_konv-mwsk1 kposn = w_konv-kposn  .
*    IF w_konv-mwsk1 <> ''.
IF flag1 = '1'.
READ TABLE it_komv INTO wa_komv WITH  KEY kposn = w_konv-kposn.
kbtr
= wa_komv-kwert.
CLEAR wa_komv.
ENDIF.

IFflag1 = '1'.
amount2
= amount2 + w_konv-kwert + kbtr.
  ELSE.
kbtr = ( w_konv-kwert * kbtr2 ) / 100.


    amount2 = amount2 + w_konv-kwert + kbtr.


ENDIF.
    IF w_konv-waers IS NOT INITIAL.
      waers = w_konv-waers.
ENDIF.

CLEAR kbtr.
**--------------------------------------------------------------------*
*    " Change on 15/Jan/2014 by Delta-ABAP
*    " TR -  DEVK902888
    IF w_konv-kschl = 'WOTB'.
      amount2 = amount2 - w_konv-kwert .
ENDIF.
*--------------------------------------------------------------------*
ENDLOOP.

CLEAR flag1.


Viewing all articles
Browse latest Browse all 2801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>