07-20-2007 12:49 PM
Hi Friends,
I havea requirement inwhich i need to multiply the field vales of two different internal tables & display them.
ITAB has fields A,B,C,D,E Having values 10,20,30,40,50 and
JTAB has fields F,G,H,I,J having values 2,4,6,8,10
Now I ned to multiply A & F & I should get output 20.
similarly for B & G i should get output 80.
thanks in advance.
I promise to reward.
07-20-2007 12:52 PM
HI Annapurna,
If they have only one record each, then its no big deal.
read itab index 1.
read jtab index 1.
V_result = itab-a * jtab-f * jtab-i.
v_result2 = itab-b * jtab-g.
REgards,
Ravi
07-20-2007 12:52 PM
HI Annapurna,
If they have only one record each, then its no big deal.
read itab index 1.
read jtab index 1.
V_result = itab-a * jtab-f * jtab-i.
v_result2 = itab-b * jtab-g.
REgards,
Ravi
07-20-2007 1:11 PM
types:begin of it,
zch(5) type c,
zint type i,
end of it.
data itab type table of it with header line.
data wa type it.
data jtab type table of it with header line.
data ktab type table of it with header line.
itab-zch = 'B'.
itab-zint = 10.
append itab.
itab-zch = 'A'.
itab-zint = 40.
append itab.
jtab-zch = 'C'.
jtab-zint = 2.
append jtab.
jtab-zch = 'D'.
jtab-zint = 10.
append jtab.
data zcount type i.
loop at itab.
zcount = sy-tabix.
read table jtab index zcount.
concatenate itab-zch 'X' jtab-zch into ktab-zch.
ktab-zint = itab-zint * jtab-zint.
append ktab.
endloop.
loop at ktab.
write:/ ktab-zch, ktab-zint.
endloop.
07-20-2007 1:38 PM
It depends on how the two internal tables are releated. You can loop one table and read the second table based on a key field.