‎2008 Aug 28 5:12 AM
hi all
In my output internal table i have same records but amout and other integer fields are different. i want create single record with same fields but compute amount and integer fields and write output another internal table.
EX: 1252, 10, coal , 200, ton, 255.00, 500.00
1252, 10, coal , 200, ton, 155.00, 400.00
i want output record is :
1252, 10, coal, 200, ton, 410.00, 900.00
regords
polisetti
‎2008 Aug 28 5:18 AM
Hi
Use COLLECT statement for amount fields
else go for simple sum operation while looping the internal table.
With Regards,
Dwarakanath.S
‎2008 Aug 28 5:18 AM
Hi
Use COLLECT statement for amount fields
else go for simple sum operation while looping the internal table.
With Regards,
Dwarakanath.S
‎2008 Aug 28 5:33 AM
write collect statement on your internal table
Collect itab ..(please check the syntax)
~hitesh
‎2008 Aug 28 5:18 AM
assuming that you have field1 to field7 as your internal table fields, then you can do some thing like this..
data: wa like line of itab.
sort itab by field1 field2 field3.
loop at itab.
wa = itab.
at end of field3.
sum.
wa-filed6 = itab-field6.
wa_field7 = itab-field7.
append wa to it_final.
endat.
endloop.
‎2008 Aug 28 5:20 AM
Hi,
try to create a structure.....
Like..
Types: Begin of ty_struct,
-
define ur fields here
-
End of ty_struct.
Define one internal table of above structure..
Data: it_table type table of ty_struct.
Use this internal table now..
regards
Mudit
‎2008 Aug 28 5:25 AM
Hi,
Use AT END of statement as follows,
Loop at itab into wa_tab.
wa_tab-field6 = sum1 + wa_tab-field6 .
wa_tab-field7 = sum2 + wa_tab-field7 .
At END of field1.
MOVE sum1 to wa_newitab-field6.
MOVE sum2 to wa_newitab-field7.
..
All remaining field also move to new itab as above.
END AT.
Regards,
Kusuma