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

help with internal table modification

Former Member
0 Likes
339

hi!

can someone explain how I can add all the values in a column and write the result in another column?

thx,

Srikanth.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
318

hi ,

20 
30 
40    90 "---> the sum is captured over here .

just execute the code .

data: begin of itab occurs 0 ,
      f1 type i ,
      f2 type i,
      end of itab.
data : sum type i.
data : cntr like sy-tabix.


      itab-f1 = '20'.
      append itab.

      itab-f1 = '30'.
      append itab.

      itab-f1 = '40'.
      append itab.



      loop at itab.

      sum = sum + itab-f1.
      cntr = cntr + 1.
      at last.
      itab-f2 = sum.
      clear sum.

      modify itab index cntr transporting f2.
      endat.

      endloop.

     loop at itab .
      write:/ itab-f1,
              itab-f2.
      endloop.

regards,

vijay

2 REPLIES 2
Read only

Former Member
0 Likes
319

hi ,

20 
30 
40    90 "---> the sum is captured over here .

just execute the code .

data: begin of itab occurs 0 ,
      f1 type i ,
      f2 type i,
      end of itab.
data : sum type i.
data : cntr like sy-tabix.


      itab-f1 = '20'.
      append itab.

      itab-f1 = '30'.
      append itab.

      itab-f1 = '40'.
      append itab.



      loop at itab.

      sum = sum + itab-f1.
      cntr = cntr + 1.
      at last.
      itab-f2 = sum.
      clear sum.

      modify itab index cntr transporting f2.
      endat.

      endloop.

     loop at itab .
      write:/ itab-f1,
              itab-f2.
      endloop.

regards,

vijay

Read only

0 Likes
318

thx Vijay!