‎2008 Jan 29 12:39 PM
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
‎2008 Jan 29 12:51 PM
LOOP it INTO wa.
WRITE <field1>,<field2>.
AT LAST.
WRITE: 'Sum:', 20 sum(t2),
ENDAT.
ENDLOOP.
‎2008 Jan 29 12:42 PM
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
‎2008 Jan 29 12:43 PM
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
‎2008 Jan 29 12:43 PM
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
‎2008 Jan 29 12:44 PM
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
‎2008 Jan 29 12:51 PM
LOOP it INTO wa.
WRITE <field1>,<field2>.
AT LAST.
WRITE: 'Sum:', 20 sum(t2),
ENDAT.
ENDLOOP.