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: 

how to calculate the subtotals in smartform

Former Member
0 Kudos

hi all

can any body tell me how can i display teh subtotals in smartform, please tell me the steps how to do that and aslo is there any special events in smartforms that are helpfull in getting and displaying the subtotals in smartforms

thanks in advance

2 REPLIES 2

Former Member
0 Kudos

check demo example SF_EXAMPLE_02

Former Member
0 Kudos

Hi,

For doing subtotal calculation in SMARTFORMS, do like this.

Create one "Program Lines" to your main window table row.

Already you are maintaing "Internal table" for you table in main window.

Before that, sort the particular internal table with key fields through which you want to find out the sub total, now within the program lines code, first identify how many quantity and currency fields are there.

Declare respective temporary variables for each and every quantity and currency field.

then write logic like this.

at new matnr.

v_menge = wa_out-menge + v_menge.

v_netwr = wa_out-netwr + v_netwr

end at.

Also dont forget to declare character variables for quantity and currency fields. We cannot directly display them in smartforms. we need to pass them to the respective quantity and currency fields.

After end at statement write like this,

write: / v_menge decimals 2 to v_mengetext,

v_netwr decimals 2 to v_netwrtext.

after this dont forget to clear,

clear: v_menge, v_netwr.

no populate v_mengetext and v_netwrtext in your text elements.

Regards,

Santosh Kumar M.