Application Development and Automation 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:Ā 
Read only

NETWR value

Former Member
0 Likes
1,320

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.

5 REPLIES 5
Read only

Former Member
0 Likes
1,028

--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

Read only

Former Member
0 Likes
1,028

LOEKZ = 'X' or '', i dont know what is 'L'.

Regards

Prabhu

Read only

Former Member
0 Likes
1,028

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

Read only

Former Member
0 Likes
1,028

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

Read only

Former Member
0 Likes
1,028

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.