| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Document Categories:
What's New?
Contribute?Sample SpecsWhat's Hot? |
Calculating Page-wise Sub-Totals and Grand Total in Adobe formsBy Nisrin Pindwarawala, YASH Technologies 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 'PRICE'. Step
1:
Go to Transaction SFP and Create an Interface.
Step
2:
Add the internal table it_sflight in global data
Step
3: In
the Code Initialization part, fetch records from sflight into internal table
it_sflight. SELECT *
FROM SFLIGHT INTO TABLE IT_SFLIGHT
UP TO 50 ROWS.
Step
4: Save
and activate the interface. Step
5:
Go to transaction SFP and create a form.
Step
6:
In the context part of the form drag and drop the table sflight from global data
of interface area to the context area and deactivate the field which we don't
require in the layout.
Step
7:
Create a table by drag n drop from library on to the layout. Include one header
row and footer row in the table.
Enter the name of the field you want to display in the header
row of the table.
Move the table fields from the table by drag n drop from Data
View Palette on to the body row of the table, which we have created. In the
footer row insert a text field in the last column from the library as shown
below.
Step
8: Calculating Sub-Total for field price. Firstly enable JavaScript for the text field, which we
created in footer row. We can achieve this by selecting,
Write this code in the area provided under these selection
boxes. var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var total = 0;
for (var i=0; i <= fields.length-1; i++) {
if (fields.item(i).name == "PRICE") {
total = total + fields.item(i).rawValue;
}
}
this.rawValue = total;
Click Enter Script Source Changes + to add the script to your form.
The value tab of the text field has to be set as below.
|
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||