Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

subtotal in smartforms

Former Member
0 Kudos

hi,

how to get subtotal in smartforms.

regards,

kathir.

1 ACCEPTED SOLUTION

rahulkavuri
Active Contributor
0 Kudos

please award points if found helpful

more specifically

SF_EXAMPLE_01

Simple example; invoice with table output of flight booking for one customer

SF_EXAMPLE_02

Similar to SF_EXAMPLE_01 but with subtotals

4 REPLIES 4

rahulkavuri
Active Contributor
0 Kudos

please award points if found helpful

more specifically

SF_EXAMPLE_01

Simple example; invoice with table output of flight booking for one customer

SF_EXAMPLE_02

Similar to SF_EXAMPLE_01 but with subtotals

Former Member
0 Kudos

Hi,

You can thread the sfsy-page field.

This field give the current page number.

You can, for example add a code block with :

if sfsy-page ne w_sfsy_init.

clear w_sum.

endif.

I Think you can also count your number of line in a page. ( works only if different pages have the same line number )

go through this link:

http://sappoint.com/abap/

Former Member
0 Kudos

Hi,

I think there is no automated way of putting subtotals in smartform.

What you should do is add a new edit mask after the items loop, and have the totals prepared in advance in the print program of your smartform. Pass the totals to the form though another structure.

The other thing you could do, is add abap code in the items loop, summing data as you go in a separate global field defined in the smartform, and display the result in a separate structure after the loop.

Regards,

0 Kudos

In the table, in which you are displaying the items,

1.Give the field name for which you want the sort criteria(based on which the subtotal is needed). Then click on the radio button u2018event on sort endu2019. ( For eg: you are looping the internal table it_sflight into wa_sflight which contains the fields carrid , connid and price. And you want to print the subtotal on the basis of connid. In the table, in the data tab give the sort criteria field as connid and click on event on sort end )

2.An event node will be created.

3.Create two table lines in the event node.

a.One for displaying the items

b.Other for displaying the subtotal.

4.Create program lines in the table and write the code as Subtotal = subtotal + wa_sflight-price.

5.Create a text in the subtotal tableline and drag the subtotal variable there.

6.After the subtotal variable is displayed, clear the variable subtotal.(Clear: subtotal in a program line)

Edited by: Shiny S Krishna on Jun 30, 2008 5:06 AM