Sie sind auf Seite 1von 11

This Tutorial focuses on how to calculate Page-wise Sub-Totals and Grand Total in Adobe

forms using JavaScript.


In this demo, we will work with table 'SFLIGHT' and calculate Sub-totals and Grand total for the
field 'PRI!'"
Step 1# Go to Transaction SFP and reate an Interface"

Step 2# $dd the internal table it%sfli&ht in &lobal data

Step ! In the ode Initiali'ation (art, fetch records from sfli&ht into internal table it%sfli&ht"
SELECT *
FROM SFLIGHT INTO TABLE IT_SFLIGHT
UP TO 50 ROWS.

Step "! Sa)e and acti)ate the interface"
Step #! Go to transaction SFP and create a form"

Step $# In the conte*t (art of the form dra& and dro( the table sfli&ht from &lobal data of interface
area to the conte*t area and deacti)ate the field which we don't re+uire in the la,out"

Step %! reate a table b, dra& n dro( from librar, on to the la,out" Include one header row and
footer row in the table"


!nter the name of the field ,ou want to dis(la, in the header row of the table"

-o)e the table fields from the table b, dra& n dro( from .ata /iew Palette on to the bod, row of
the table, which we ha)e created" In the footer row insert a te*t field in the last column from the
librar, as shown below"

Step &! 'alculating Sub-Total for field price.
Firstl, enable 0a)aScri(t for the te*t field, which we created in footer row"
1e can achie)e this b, selectin&,
Select 2!)ents with Scri(ts2 in the Show dro( down list
Select 20a)aScri(t2 in the Lan&ua&e dro( down list
Run at# 2lient2 as shown below"
1rite this code in the area (ro)ided under these selection bo*es"
var feld ! "#a.la$%&'.(a)eC%*'e*'+"#a.la$%&'.(a)e+',-./01 2feld21 0.3
var '%'al ! 03
#%r +var -!03 - 4! feld.le*)',/03 -55. 6
-# +feld.-'e7+-..*a7e !! 2PRICE2. 6
'%'al ! '%'al 5 feld.-'e7+-..ra89al&e3
:
:
',-.ra89al&e ! '%'al3
lick !nter Scri(t Source han&es 3 to add the scri(t to ,our form"

The )alue tab of the te*t field has to be set as below"
Step (! 'alculating Grand Total.
Grou( the elements of the bod, row, and then insert subform b, ri&ht clickin& on data"


-o)e the table under the subform and Insert a new subform with a te*t field under it"


$fter followin& these ste(s,
From the dro( down list 2Show2 select alculate
!nable Formalc for the te*t field 2Grand Total2 as shown below"
Step 1)! 'ode for Grand-Total
1rite the code under the area (ro)ided for the te*t field
sum4.ata"Table5"Grou(5"Row5678"PRI!6789
lick !nter Scri(t Source han&es 3 to add the scri(t to ,our form"
Step 11! Sa)e and acti)ate the form" !*ecute the form.
The out(ut a((ears like this#
Page1!
Page2!

Das könnte Ihnen auch gefallen