Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

TReport: report structure

Organizes report definition and printing processing.

TReport: report structureAdvPL
01 · OVERVIEW

Overview

TReport contains sections, cells, breaks and totals and replaces legacy SetPrint/SetDefault/RptStatus/Cabec. Its constructor receives ID, title, parameters and bAction invoked on printing confirmation. Defining layout does not print records. The community sample separates definition/data processing and uses section Init/PrintLine/Finish. Its SQL and fixed aliases are not copied: real integration needs context, cancellation, cleanup and correct filtering. This block only prepares construction with a caller-supplied action. (Sources: refs. 1–2.)

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed698()
    // Uninvoked block: bPrint must implement real processing.
    Local bCreate := {|bPrint| TReport():New("ED698","Example report",,bPrint)}
    ConOut(ValType(bCreate))
Return Nil
Expected result

Creates block B without a dialog or printing. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Do not treat construction as printing confirmation. Check memory, pagination and release-specific XLSX output behavior.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. TReport. Estrutura, New e ciclo de impressão. Accessed on 2026-10-28.
  2. Atilio. dan-atilio/AdvPL. Maratona de Exemplos/Exemplo_505_Classes_TReport_TRFunction_TRSection_e_TRCell.prw. Arquivo completo analisado; adaptação editorial. Accessed on 2026-10-28.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha