2009 Mar 24 5:54 PM
Hi all,
I am developing a report o/p of which is a file in excel format.Now in the file for the data which is being exported to the file,I need to make the following changes:
Follwing are the columns in the file:
g/l acc amount vendor description company code.
At each change in the company code value,I need to insert a new line in the file (file data) which should have the sum of the amounts in the column "amount" in the new line and the company code .All other fields in the new line should be blank.See below for the exact o/p needed:
g/l acc amount vendor description company code.
5550601 10 ABC VISA FEB 2009 US02
5550601 20 ABC VISA FEB 2009 US02
5550601 30 ABC VISA FEB 2009 US02
5550601 40 ABC VISA FEB 2009 US02
-->new line -
100 US02
5550609 15 ABC VISA FEB 2009 US03
5550609 15 ABC VISA FEB 2009 US03
5550609 17 ABC VISA FEB 2009 US03
5550609 18 ABC VISA FEB 2009 US03
-->new line 65 US03
5550607 15 ABC VISA FEB 2009 US04
Can anyone explain how to modify the data(before creating the file) to get the o/p in the file as mentioned above?
Thanks.
2009 Mar 24 6:05 PM
Sounds like a make work project to me. Since it's an Excel file, the user can do this much more easily than a programmer.
Rob
2009 Mar 24 6:11 PM
Hi,
Thanks.But i need to do the modifications in the fiel data before the file is created.I know I can use AT NEW statement but not sure how to insert the new line?
2009 Mar 24 6:17 PM
You can insert a line using the INDEX option of INSERT. But it would be easier if you could do this while creating the internal table.
Rob
2009 Mar 24 6:24 PM
HI,
Check this code
data l_final tye itab.
Loop at Itab INTO wa.
l_amount = l_amount + wa-amount.
Append wa to Final.
At END of companycode.
l_final-amount = l_amount.
l_final-companycode = wa-companycode.
Append l_final to final.
claer : l_final, l_amount.
ENDAT.
Clear wa.
Endloop.
2009 Mar 24 6:39 PM
data = b(6) type n .
itab1[] = itab[].
loop at itab into w_itab.
index = index + 1.
a = a + amount.
w_itab-bukrs = itab-bukrs.
at end of
w_itab-amount = a.
b = b + 1.
ind = index + b.
append itab1 from w_itab index ind.
clear a.
endat.
endloop.
PBS - please use code tags.
Edited by: Rob Burbank on Mar 24, 2009 2:43 PM