12-19-2005 4:06 PM
hi friends,
can plz some one help me with summing in scripts. like, printing customer orders sub total, and grand total. i have gone throgh the documentation, iam not really ok with that.
with regards,
vijay
12-19-2005 4:11 PM
/:SUMMING program symbol INTO sum symbol
As SAP script cannot define sum fields dynamically, the sum symbol must be in a structure of the calling program, which was declared with TABLES.
instead of that you populate in driver program and pass it to layout.
12-19-2005 4:46 PM
hi vijay thanks very much for ur reply, could u plz explain that step by step in detail.
with regards,
vijay
12-19-2005 4:53 PM
/:SUMMING &NETPR& INTO V_TOTAL
loop
<b>write form for main window</b>
endloop.
for every time(loop pass) the value will be added to v_total ,this will be defined in script.
12-19-2005 8:12 PM
You can sum the total in the program that calls the script and print it in the script.
lets say you have an internal table and you writing as lines in the script.
01 10 usd
02 20 usd
etc...
99 10 usd
call funtion 'open_form'
loop at itab.
call funtion 'write_form
element = '100' (for lines)
g_total = g_total + itab-value.
at last.
call funtion 'write_form
element = '101' (for total)
endat.
endloop.
so at the end of all the line items printed, the element 101 will be called and the total is printed there.
For subtotals and totals on each page you have to come with a logic to sum in the wrapper program and pass it on to the SAP script.
Kannan