Suppressing the page header till the last page in SAP Crystal Reports 2008

To suppress the page header until the last page in SAP Crystal Reports 2008, you need to use the OnLastRecord function. This function is essential for controlling header visibility based on record position within your report.

OnLastRecord Function

Function Description:

This function returns TRUE when the current record being evaluated is the last record in the report.

Returns:

Boolean Value (TRUE or FALSE)

Action:

This function evaluates each record and returns TRUE only when processing the final record in the report. You can use this in conditional suppression formulas to control when headers appear.

Suppressing Headers for Grouped Data

When working with grouped fields, you need to suppress headers on the last record for each group. Combine the OnLastRecord function with the next() function as shown below ?

onlastrecord or next({table.field})<>{table.field}

Example

Consider a report structure with nested groups and conditional suppression ?

GH1 (using Customer.ID as group)
GH2 (using Sales.No as group)
Details
GF2 - has line drawn on it
    Conditional suppression using the formula:
    onlastrecord or next({customer.ID})<>{customer.ID}
GF1

In this example, the group footer (GF2) will be suppressed except on the last record of each customer group. The formula checks if it's the last record overall OR if the next record has a different Customer ID, indicating the end of the current group.

Implementation Steps

To implement header suppression ?

  1. Right-click on the page header section you want to suppress
  2. Select "Section Expert" from the context menu
  3. Check the "Suppress" option
  4. Click the formula button (x+2) next to "Suppress"
  5. Enter your suppression formula using OnLastRecord

Conclusion

The OnLastRecord function provides precise control over header suppression in Crystal Reports, allowing you to display headers only on the final page or last record of grouped data.

Updated on: 2026-03-13T18:58:35+05:30

818 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements