Application Development 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: 

Internal Table Fields - Multiply ?

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

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

3 REPLIES 3

former_member181962
Active Contributor
0 Kudos

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

former_member188827
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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.