‎2008 Jul 22 11:33 AM
hi,
I am using at last statement in my code in the following code:-
LOOP AT ITAB1.
AT LAST.
SUM .
WRITE: / ITAB1-SPART,ITAB1-TOT1.
ENDAT.
ENDLOOP.
The code above perform the calculation of the field ITAB1-TOT1.
But in output it does not display the division number (ITAB1-SPART) and instead of it shows **.
I want to show the division no also but due to using of the keyword SUM it does not display it and i had tried to define field spart along with sum but it gives the syntax error.
can any body provide me guidlines for solving this problem.
‎2008 Jul 22 11:39 AM
use READ ..
LOOP AT ITAB1.
AT LAST.
read table ITAB1 index sy-tabix.
SUM .
WRITE: / ITAB1-SPART,ITAB1-TOT1.
ENDAT.
ENDLOOP.
‎2008 Jul 22 11:38 AM
Hi,
The fileds left to tot1 will not be worked with in the cotrol command statements like at new,at end of,at lat.
So Modify the code as follows.
data:
w_SPART type vbak-SPART.
LOOP AT ITAB1.
w_SPART = itab1-spart.
AT LAST.
SUM .
WRITE: / w_SPART,ITAB1-TOT1.
ENDAT.
ENDLOOP.
‎2008 Jul 22 11:39 AM
use READ ..
LOOP AT ITAB1.
AT LAST.
read table ITAB1 index sy-tabix.
SUM .
WRITE: / ITAB1-SPART,ITAB1-TOT1.
ENDAT.
ENDLOOP.
‎2008 Jul 22 11:50 AM
HI SRINIVAS,
i had assigned the full points to u as u had solved my problem.
thanks
‎2008 Jul 22 11:42 AM
try writing using the position(length) information..
ex write 30(50) ITAB1-Field1.
~Piyush Patil
‎2008 Jul 22 11:48 AM
hi,
the SUM statement in control break events like AT LAST works only for numeric value and not for character fields, it will sum up all the numeric fields of your internal table.
so if you wants to sum SPART, you cannot do it in AT LAST, you have to do it outside this AT LAST event.
With luck,
Pritam.
‎2008 Jul 22 11:48 AM
Hi Abaper,
Use..
LOOP AT ITAB1.
WRITE: /5 ITAB1-SPART, 15 ITAB1-TOT1.
AT LAST.
SUM .
WRITE: /5 'Total', 15 ITAB1-TOT1.
ENDAT.
ENDLOOP.