‎2007 Nov 28 10:28 AM
Hi people i explain my situation.
I have a table with some component.
Every component have a type. For example:
Pos Name Netprice Type Uepos
10 xxxx xxxx TAP
20 yyyy yyyy TAN 10
30 zzzz zzzz TAN 10
Now i must do it.
Loop at this table, if TYPE = TAN i read the UEPOS value and get it into a Zvariable.
Now i must reloop in the table because i must SUM the Netprice of every element Type TAN that have the same UEPOS, and this UEPOS must be the same of the POSNR of the element that have the Type TAP.
Understand? I Know it's difficolt to explain. I try more in another type.
I have this situation:
POS NAME NETPR
10 A 0
20 A.1 xx
30 A.2 yy
40 B 0
50 B.1 xx
In this actual situation the A.1 are dependento of A and i wanto to sum in the NETPR of A the netpr xx , yy of the A.1 and A.2. then the same for B position.
Thanks for the attention.
‎2007 Nov 28 10:37 AM
hey i think you can do like this.
SORT ITAB by TYPE UEPOS.
clear: w_type, w_uepos, w_netpr.
loop at itab.
if w_type ne itab-type
or w_uepos ne itab-uepos.
here you can capture previous type and uepos.. so write logic to use netprice before clearing that.
clear w_netpr.
w_type = itab-type.
w_uepos = itab-uepos.
endif.
w_netpr = w_netpr + itab-netprice.
endloop.
Pos Name Netprice Type Uepos
10 xxxx xxxx TAP
20 yyyy yyyy TAN 10
30 zzzz zzzz TAN 10
‎2007 Nov 28 10:37 AM
hey i think you can do like this.
SORT ITAB by TYPE UEPOS.
clear: w_type, w_uepos, w_netpr.
loop at itab.
if w_type ne itab-type
or w_uepos ne itab-uepos.
here you can capture previous type and uepos.. so write logic to use netprice before clearing that.
clear w_netpr.
w_type = itab-type.
w_uepos = itab-uepos.
endif.
w_netpr = w_netpr + itab-netprice.
endloop.
Pos Name Netprice Type Uepos
10 xxxx xxxx TAP
20 yyyy yyyy TAN 10
30 zzzz zzzz TAN 10