cancel
Showing results for 
Search instead for 
Did you mean: 

calculating subtotals and totals in smartforms

Former Member
0 Kudos

Hi,

can anyone let me know how to calculate subtotals when data is being displayed in the MAIN AREA of a TABLE(not on a window).

and also please let me know how to calculate TOTALS seperately for each page when data being displayed in the MAIN AREA of a TABLE.

I have already looked into SF_TOTALS and SF_SUBTOTALS report but was not able to make out the logic.

Thanks,

BJR.

Accepted Solutions (1)

Accepted Solutions (1)

brad_bohn
Active Contributor
0 Kudos

The smartform logic is pretty straightforward...there's a simple code node in one cell in the main loop processing that collects row values into a global table. The sort events (indicated on the Data tab) are used to output the subtotals (within a LOOP node).

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks to Brad,Sumit and Suvajit for your valuble replies

Former Member
0 Kudos

Hi,

First calculate the total number of records to be displayed in smartform.(ex:- w_record).

Now,Declare a table in the main window.Go to Calculation tab in the table and do the followings.

Operation: Total

Field name: name of the field on which you want to take totals or subtotals

Target Field Name:w_total

Time: After Loop.

Now go to the footer part of the table create a rowtype.and create two text under it and rename it.(say-Pagetotal and Grand total).

Under the pagetotal text you can find general attribute tab.Right the following:

Page total :&w_pagetot&

and then go to condition tab.Write w_record NE w_line.(It means when the number of lines in each page not equals to number of records the page total will be print).Here w_line is a variable of I which will be increased per record.

Do the same for Grandtotal text.

Under the pagetotal text you can find general attribute tab.Right the following:

Page total :&w_total&

and then go to condition tab.Write w_record EQ w_line.(It means when the number of lines in each page equals to number of records the total will be print).

former_member193284
Active Participant
0 Kudos

Hi,

you can try using final window in smart form. This is mainly used to calculate totals & subtotals.

you have an option there to specify the field on which you need subtotal or total.

Hope this helps.

Thanks