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

general

Former Member
0 Likes
618

Hey Folks,

I have a req.. where i have to sum up the records and display at the footer in a classical report for example

matnr price

a 1

b 2

c 3

d 4

i have to get

matnr price

a 1

b 2

c 3

d 4

-


10

could somebody write me a sample codew for this as it is urgent and i m stuck with it.

Regards

Rock

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
591

LOOP it INTO wa.

WRITE <field1>,<field2>.

AT LAST.

WRITE: 'Sum:', 20 sum(t2),

ENDAT.

ENDLOOP.

5 REPLIES 5
Read only

Former Member
0 Likes
591

Use the control Break AT LAST with in the ITAB loop and then use the SUM command. It sums all numaric fields only. But ur MATNR is of CHAR type. So, u have to convert CHAR to NUM type.

then, after printing the ITAB, u can use uline and then print the SUM

Narendra

Read only

Former Member
0 Likes
591

IF YOU ARE USING INTERNAL TABLE THEN

SUM = 0.

START-OF-SELECTION.

LOOP AT INTERNAL_TABLE INTO WA.

SUM = SUM + MATNR_PRICE.

ENDLOOP.

WRITE: ULINE.

WRITE: SUM.

REWARD POINTS IF HELPFUL,

KUSHAGRA

Read only

Former Member
0 Likes
591

Use the control Break AT LAST with in the ITAB loop and then use the SUM command. It sums all numaric fields only. But ur MATNR is of CHAR type. So, u have to convert CHAR to NUM type.

then, after printing the ITAB, u can use uline and then print the SUM

Narendra

Read only

Former Member
0 Likes
591

Use the control Break AT LAST with in the ITAB loop and then use the SUM command. It sums all numaric fields only. But ur MATNR is of CHAR type. So, u have to convert CHAR to NUM type.

then, after printing the ITAB, u can use uline and then print the SUM

Narendra

Read only

Former Member
0 Likes
592

LOOP it INTO wa.

WRITE <field1>,<field2>.

AT LAST.

WRITE: 'Sum:', 20 sum(t2),

ENDAT.

ENDLOOP.