ā2006 Aug 30 10:31 AM
For a particular PO suppose 3100000180 it has 3 line items in EKPO table, the deletion indicator LOEKZ values are L,null,null for 3 line items..now I want to display all line items of that PO ..and condition is if LOEKZ = L then make NETWR = 0.00 if not it should take the value which has in NETWR field. And I kept one variable(V_NETWR) where it store all line item NETWR(i.e, sum of all 3 line item NETWR) it should not take L items NETWR but it should add all the LOEKZ = null values.
Given below is the code ..but all conditions are not populated can anyone help me out
Loop at lt_ekpo where ebeln = lt_ekpo-ebeln.
v_netwr = lt_ekpo-netwr.
IF lt_ekpo-loekz = 'L'.
move '0.00' to v_netwr.
endif.
SHIFT v_netwr LEFT DELETING LEADING space.
v_total1 = v_total1 + lt_ekpo-netwr.
MOVE v_total1 TO v_total.
SHIFT v_total LEFT DELETING LEADING space.
Endloop.
ā2006 Aug 30 10:35 AM
--Please note the below corrections.
--Please check the variable in bold as it should be some other lebelnr and not lt_expo-ebeln.
Loop at lt_ekpo where ebeln = <b>lt_ekpo-ebeln</b>.
v_netwr = lt_ekpo-netwr.
IF lt_ekpo-loekz = 'L'.
move '0.00' to v_netwr.
endif.
SHIFT v_netwr LEFT DELETING LEADING space.
*v_total1 = v_total1 + lt_ekpo-netwr.
v_total1 = v_total1 + v_netwr.
MOVE v_total1 TO v_total.
SHIFT v_total LEFT DELETING LEADING space.
Endloop.
--Secondly, I would advice to define v_netwr like ekpo-netwr in that case you dont need to use shift statements unless if you wish to display it in some other way as character.
Message was edited by: Anurag Bankley
Message was edited by: Anurag Bankley
ā2006 Aug 30 10:35 AM
ā2006 Aug 30 10:39 AM
what i understood was,
if LOEKZ <> 'L'.
then you should make EKP0-NETWR field.
and you want to calculate totals based on LOEKZ = space.
if i am right, check the logic given below.
Loop at lt_ekpo where ebeln = lt_ekpo-ebeln.
<b> clear V_NETWR.
IF lt_ekpo-loekz <> 'L'.
v_netwr = lt_ekpo-netwr.
SHIFT v_netwr LEFT DELETING LEADING space.
endif.
IF lt_ekpo-loekz = 'L'.
v_total1 = v_total1 + lt_ekpo-netwr.
MOVE v_total1 TO v_total.
SHIFT v_total LEFT DELETING LEADING space.
endif.</b>
Endloop.Message was edited by: Srikanth Kidambi
Message was edited by: Srikanth Kidambi
ā2006 Aug 30 10:41 AM
Hi,
Follow below logic
delete it_ekpo where loekz = 'L'.
Now ur internal table will have active po where
loekz is initial.
Loop at lt_ekpo where ebeln = lt_ekpo-ebeln.
v_netwr = lt_ekpo-netwr.
SHIFT v_netwr LEFT DELETING LEADING space.
v_total1 = v_total1 + lt_ekpo-netwr.
MOVE v_total1 TO v_total.
SHIFT v_total LEFT DELETING LEADING space.
Endloop.
Regards
Amole
ā2006 Aug 30 10:43 AM
Are you sure the below statement is correct , u r looping the same table which is in where condition??
Loop at <b>lt_ekpo</b> where ebeln = <b>lt_ekpo</b>-ebeln.