If an SAP invoice has several pages, the sum of all the positions of the current page at the end of a page should be displayed. It is the classical demand for a representation of the carry over on a bill.


We have an invoice with 3 pages.

SAP Adobe Form subtotals

Invoice with 3 pages

Step 1) Create a numeric field after the printout of the position value

A field with the following properties is added to each line where the position value is printed. In our example, this affects the line at material number level (if no conditions are printed) or in the condition line (if conditions are printed in detail).

  • Type: numeric field
  • Presence: invisiblet)
SAP Adobe Form Übertrag 2
  • Display pattern: 2 decimal places
  • Binding: Position value (must be a field of the type DEC or CURR or QUAN, that is, no field of type CHAR)
SAP Adobe Form Subtotal 3


Step 2) Create a line to print the carry over at the end of each page

  • At the end of the DATA area, a subform CARRY_OVER is created to print the carry over at the end of each page.
SAP Adobe Form Übertrag 4

On the “Pagination” tab in the DATA subform, enter “CARRY_OVER” in the “overflow area”.

SAP Adobe Form Übertrag 6

A KWERT_CARRY_OVER field is inserted in the CARRY_OVER subform with the following properties.

  • Type: numeric field
  • Display pattern: 2 decimal places
  • Binding: no data binding

In the KWERT_CARRY_OVER element, the following scripting type JAVASCRIPT is placed at the time CALCULATE:

var fields = xfa.layout.pageContent(xfa.layout.page(this), „field“, 0);
var total = 0;

for (var i=0; i <= fields.length-1; i++)
if (fields.item(i).name == „KWERT_CO“)
total = total + fields.item(i).rawValue;

this.rawValue = total;

Now the Adobe Form can be activated and tested for the output of the subtotals per page / carry over.