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

internal table

Former Member
0 Likes
696

hi frnd's,

I had an internal table with 5 fields.I want to sum up (total) a one field value and dispaly it in the screen.

can this be possible.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
683

Hi Suganya,

Can u explain ur question?

U want to sum your field values at the end of the internal table??

7 REPLIES 7
Read only

Former Member
0 Likes
684

Hi Suganya,

Can u explain ur question?

U want to sum your field values at the end of the internal table??

Read only

0 Likes
683

Example I had a field name a,b,c in internal table it_alpha.

It contains ten datas in to it,then i wnt to sum all the datas of field a in it_alpha,and display it into the textfield total__________ in screen.

Read only

0 Likes
683

DATA sum LIKE it_alpha-a.

LOOP AT it_alpha.

sum = sum + it_alpha-a.

ENDLOOP.

Now use the sum wherever you want.

Regards,

Wenceslaus.

Read only

suresh_datti
Active Contributor
0 Likes
683

Hi,

Pl try this..


SORT ITAB.

LOOP AT ITAB.
AT LAST.
SUM.
write:/ itab-field. "the field you want to total
endat.
endloop.

Regards,

Suresh Datti

Read only

0 Likes
683

it is not a report program.

Read only

Former Member
0 Likes
683

The internal table has fields a,b,c. U want to sum the values of a & display it.

declare variale sum.

Loop at it_alpha.

sum = sum + it_aplha-a.

endloop.

Use the sum at last to display it in the textfield total__________ in screen.

Read only

venkata_ramisetti
Active Contributor
0 Likes
683

HI,

Write code similar to below.

DATA:BEGIN OF ITAB OCCURS 0,

FIELD1 TYPE FIELD1,

FIELD2 TYPE FIELD2,

FIELD3 TYPE FIELD3,

AMOUNT TYPE P DECIMALS 2,

QTY TYPE P DECIMALS 3,

END OF ITAB.

DATA: V_TOTAL_AMOUNT TYPE TYPE P DECIMALS 2,

V_TOTAL_QTY TYPE TYPE P DECIMALS 3.

*Assume thAT you populated data

LOOP AT ITAB.

AT FIRST.

SUM.

V_TOTAL_AMOUNT = ITAB-AMOUNT .

V_TOTAL_QTY = ITAB-QTY.

ENDAT.

ENDLOOP.

THanks,

Ramakrishna