cancel
Showing results for 
Search instead for 
Did you mean: 

Sub Total in Smartform

Former Member
0 Kudos

Hi experts,

Iam developing a smartform for invoice. My requirement is to print sub total for multiple items for one invocie. The subtotal needs to be printed for the field (netwr) to print the net price of particular item.

For example in MAIN window, there are 5 items in first page and 4 items in second page for a invoice. I want the total of 5 items to be printed in the first page at the bottom. Then, this total of the first page needs to be carried forward in 2nd page at the top. In the second page, the 4 items needs to be added to the total of first page and grand total needs to be displayed.

Please give me the detail code to develop the above requirement ASAP.

The answers will not be rewarded.

Thanks,

Chintu.

Edited by: Rob Burbank on Apr 27, 2009 2:10 PM

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Actually my page contains NETWR and also some other fields( KWERT etc). So i need to get the total of all these fields. In this case, if I specify NETWR in calculations tab, it only gives me the NETWR value. So please give me the solution to get sub total for all the fields.

Thanks

Chintu

former_member205763
Active Contributor
0 Kudos

specify all fields in calculation tab and get subtotals of each field then before printing add these varaibles

Former Member
0 Kudos

Hi

in the wiki specified below ,it had explained in very better way of your requirment.

[https://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTALINSAP+SMARTFORMS]

Regards

Hareesh Menon

babu_kilari4
Active Contributor
0 Kudos

Check SDN Wiki. There is an example meeting your requirement.

You can simply follow that.

Thanks,

Babu Kilari

Former Member
0 Kudos

Hi,

you can code like this.

in global definitions -> zsum like vbrp-netwr.( initial value = 0 )

create table in main window.

at end of main area in table create program lines & write code for subtotal.

zsum = zsum + itab-netwr. (itab is your internal table which you are looping inside table )

Dont forrget to clear this variable at last.

now display this variable in table footer.

Imp thing to note that to display subtotal at each page -> double click on footer.

There are two check boxes -> at page break & at end of table.

Check both the boxes.

Also to display first page sub total at top of next page just display that variable at appropriate place.

In condition tab of that text element check the box "Not on First Page " .

Hope this will help to solve your problem.

Regards

former_member205763
Active Contributor
0 Kudos

> The answers will be rewarded.

First of all, u r not supposed to write that, its against the rules,

coming to ur requirement,

use a table node to display line items and in the calculations tab use a variable to keep on totaling, at the end in the footer display this variable as subtotal, also store it in another variable to keep its track on next page also,

dont forget to use page protection to get consistent results