cancel
Showing results for 
Search instead for 
Did you mean: 

What is the Logic to get values of ECESS/ ECS/ SECESS in PO

ashish_shah5
Participant
0 Kudos

Hi friends,

I am creating Smartform to get PO details. I am getting NETPR / NETWR values.

But how I will calculate ECS, 2%, 4%, 8%, 1% . I want all the details in different column, I am not getting logic how I will get those values or from which table I will get?

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,KONP is the table where u can get values for this.

Refer this code

Hope this helps u.


read table pekko into WA_EKKO index 1.
lv_doc_date = WA_EKKO-BEDAT.
loop at itab_lt_items into wa_items.
break ibmabap.
 clear LV_TOT_FOR_TAX.
 LV_TOT_FOR_TAX =  wa_items-total + wa_items-pack - wa_items-discamt.
 select knumh kschl
 into CORRESPONDING FIELDS OF TABLE lt_a363
 from a363
 where lifnr = wa_ekko-lifnr
       and werks = wa_items-werks
       and matnr = wa_items-matnr
       and DATAB LE lv_doc_date
       and DATBI GE lv_doc_date.
if sy-subrc = 0.
clear : LV_ICESS , LV_ISEC_CESS , lV_IBASIC.
clear : lv_cess_rate , lv_sec_cess_rate.
loop at lt_a363 into wa_a363.
select * from konp
  into table lt_konp
  where KNUMH = wa_a363-knumh
  and kschl = wa_a363-KSchl
  and LOEVM_KO NE 'X'.
if sy-subrc = 0.
clear lv_tot_for_sales.

loop at lt_konp into wa_konp.
if lv_net_ex is initial.

if wa_konp-kschl = 'JMOP'. "or wa_konp-kschl = 'JMOQ'." basic exersice
if wa_items-flag_basic ne 'X'.
 lv_tax_per = ABS( wa_konp-kbetr ) / 10.
 lv_ibasic = ( lv_tax_per / 100 ) * LV_TOT_FOR_TAX.
 lv_basic_ex = lv_basic_ex + ( lv_tax_per / 100 ) * LV_TOT_FOR_TAX.
 wa_items-basic = lv_ibasic = ( lv_tax_per / 100 ) * LV_TOT_FOR_TAX.
 wa_items-Flag_basic = 'X'.
endif.

endif.
if wa_konp-kschl = 'JMOQ'. "or wa_konp-kschl = 'JMOQ'.
if wa_items-flag_basic <> 'X'.
lv_basic_ex = lv_basic_ex + wa_konp-kbetr.
lv_ibasic = wa_konp-kbetr.
wa_items-Flag_basic = 'X'.
endif.
endif.
if wa_konp-kschl = 'JEC1' or wa_konp-kschl = 'JEC2'." CESS
 if wa_items-flag_cess <> 'X'.
 lv_tax_per = ABS( wa_konp-kbetr ) / 10.
 lv_cess_rate = lv_tax_per.
 wa_items-Flag_cess = 'X'.
endif.
" Conditions
*lv_cess = lv_cess + ABS( wa_konp-kbetr ).
endif.
if wa_konp-kschl = 'JSEP' or wa_konp-kschl = 'JSEI'.
  if wa_items-flag_sec_cess <> 'X'.
 lv_tax_per = ABS( wa_konp-kbetr ) / 10.
 lv_sec_cess_rate = lv_tax_per.
 wa_items-flag_sec_cess = 'X'.
 endif.
endif.
endif.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Try like this

TABLES : ekko,

ekpo,

t005.

DATA : wa_komk TYPE komk,

wa_komp TYPE komp.

DATA : i_komv TYPE komv OCCURS 0,

wa_komv TYPE komv.

SELECT SINGLE * FROM ekko WHERE ebeln EQ wa_po_items-po_number.

IF sy-subrc IS INITIAL.

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.

wa_komk-kappl = 'TX'.

SELECT SINGLE * FROM t005

WHERE land1 = ekko-lands.

wa_komk-kalsm = t005-kalsm.

wa_komk-prsdt = ekko-bedat.

wa_komk-ekorg = ekko-ekorg.

ENDIF.

SELECT SINGLE * FROM ekpo WHERE ebeln EQ wa_po_items-po_number

AND ebelp EQ wa_po_items-po_item.

IF sy-subrc IS INITIAL.

wa_komp-kposn = ekpo-ebelp.

wa_komp-werks = ekpo-werks.

wa_komp-matnr = ekpo-matnr.

wa_komp-matkl = ekpo-matkl.

wa_komp-meins = ekpo-meins.

wa_komp-mglme = ekpo-menge.

wa_komp-wrbtr = ekpo-netwr.

wa_komp-mwskz = ekpo-mwskz.

wa_komp-mtart = ekpo-mtart.

wa_komk-txjcd = ekpo-txjcd.

wa_komk-mwskz = ekpo-mwskz.

ENDIF.

CLEAR : i_komv,v_excise,v_tax.

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.

SORT i_komv.

LOOP AT i_komv INTO wa_komv.

CASE wa_komv-kschl.

WHEN 'JMOP'.

wa_komv-kbetr = wa_komv-kbetr / 10.

v_excise = v_excise + wa_komv-kbetr .

WHEN 'JEC1' OR 'JSEP' OR 'JSRT' OR 'JES3' OR 'JEC3'.

wa_komv-kbetr = wa_komv-kbetr / 10.

v_excise = v_excise + ( v_excise * wa_komv-kbetr ) / 100 .

WHEN 'JVRD' OR 'JVCS'.

wa_komv-kbetr = wa_komv-kbetr / 10.

v_tax = v_tax + wa_komv-kbetr .

ENDCASE.

IF wa_komv-kschl = 'JVRD'.

v_tax_text = 'VAT'.

ELSE.

IF wa_komv-kschl = 'JVCS'.

v_tax_text = 'CST'.

ENDIF.

ENDIF.

ENDLOOP.

Former Member
0 Kudos

Hi,

For Taxes u can get it from KONV Table based on the Condition Type, the values like BED Rate, ECESS, SECSS etc can be through J_1IEXCDTL / J_1IEXCHDR these tables and this is only when u have Depo Invoice J_1IRG23D based on the reference Doc (J_1IEXCDTL / J_1IEXCHDR-VBELN = VBRP-VGBEL).

Regards,

Vijaya Lakshmi.T

Former Member
0 Kudos

Hi,

Use the function module 'PRICING'. Through this u can get all the values. Based on condition type u can print the values.

Former Member
0 Kudos

Hi,

In case of PO condition values(taxes rates & values ) are not stored in any DB table.

such as BED. CESS,ECESS.

In KONV table u will get conditions & its values which are maintained under condition tab in PO (ME21N) , but taxes such as BED. CESS,ECESS which u get after clicking invoice tab are not maintained in any DB tab.

for that u have to use FM 'Pricing'.

Just goto this FM , check import / export parameters , pass exact values and u will get above taxes in table of this FM.

Its works , i have used it many times.

Just take that table values into ur int table and display in ur smartform.

Regards