Davidson Espindola · Mar 3, 2017

zen report

Hi, all

I have the following problem in generating a PDF report in ZEN, which has many items, a general total of approximately 30,000 items, but gives an error, I can generate a report with a maximum of 8,000 items, which may be wrong.


See the error log:

6. "Error rendering: OS code=1 Use $LOG=1 to check : CSP Error"  at 11:13 am.   $I=|TCP|1972|10644   ($X=325  $Y=513)
     $J=10644  $ZA=24576   $ZB=$c(0)   $ZS=262144 ($S=267997176)

Class Ideal.ListaEstoquePDF Extends %ZEN.Report.reportPage

Parameter APPLICATION = "Ideal";

Parameter DEFAULTMODE As STRING [ Constraint ",html,pdf,xml"Flags = ENUM ] = "pdf";


Parameter XSLTMODE = "server";

XData Style
<style type="text/css">
/* style for title bar */
#title {
    colorgreen    ;
    border-bottom1px solid black;
#folha {


/// ReportDefinition is a placeholder. ///callArgument='zenPage.DtEnvio'
XData ReportDefinition [ XMLNamespace "]
<report xmlns=""
    name="MyReport" call="CriaXML"  

XData ReportDisplay [ XMLNamespace "]
<report xmlns=""
<document width="21cm" height="29.7cm"  
  marginLeft="1cm" marginRight="1cm"  marginTop="1cm" marginBottom="1cm"
   orientation="portrait" ></document>

xslfostyle="fill:yellow; font-family:Arial; font-size:9pt;" 

<table orient="col" width="6cm" >
<item literalSpaces="true" field="Orcamento" xslfostyle="text-align:right; font-size:13pt" width="11cm" />

<table class="table2"
width="100%" orient="col" xslfostyle="border:1pt solid black; background-color:silver; text-align:center; font-family:Arial; font-size:10pt;"  >
    <item literalSpaces="true" field="CabCod" xslfostyle="text-align:left; font-size:8pt" width="1.2cm"/>
    <item literalSpaces="true" field="CabDesc" xslfostyle="text-align:left; font-size:8pt" width="7.3cm"/>
    <item literalSpaces="true" field="CabQuant" xslfostyle="text-align:right; font-size:8pt" width="1.1cm" />
    <item literalSpaces="true" field="CabUnid" xslfostyle="text-align:right; font-size:8pt" width="0.9cm" />
    <item literalSpaces="true" field="CabUnit" xslfostyle="text-align:right; font-size:8pt" width="1.8cm" />
    <item literalSpaces="true" field="CabTotal" xslfostyle="text-align:right; font-size:8pt" width="1.9cm" />
    <item literalSpaces="true" field="CabFab" xslfostyle="text-align:right; font-size:8pt" width="4.5cm" />
    <item literalSpaces="true" field="CabSeq" xslfostyle="text-align:right; font-size:8pt" width="1.0cm" />
name="GrItens" pagebreak="false" width="100%" style="text-align:left"  

name="GrSeqItem" pagebreak="false" width="100%" style="text-align:left"  

<table class="table2" width="50%" orient="col" style="color: black; border:none" 
    <item literalSpaces="true" field="CodProduto" xslfostyle="text-align:left; font-size:8pt" width="1.2cm" />
    <item literalSpaces="true" field="NomeProduto" xslfostyle="text-align:left; font-size:8pt" width="7.3cm" />
    <item literalSpaces="true" field="QuantProduto" xslfostyle="text-align:center; font-size:8pt" width="1.1cm"/>
    <item literalSpaces="true" field="UnidProduto" xslfostyle="text-align:right; font-size:8pt" width="0.9cm"/>
    <item literalSpaces="true" field="ValorUnit" xslfostyle="text-align:right; font-size:8pt" width="1.8cm"/>
    <item literalSpaces="true" field="ValorTotal" xslfostyle="text-align:right; font-size:8pt" width="1.9cm"/>
    <item literalSpaces="true" field="Fabr" xslfostyle="text-align:right; font-size:8pt" width="4.5cm"/>
    <item literalSpaces="true" field="Seq" xslfostyle="text-align:right; font-size:8pt" width="1.0cm"/>


name="GrTotal" pagebreak="false" width="100%" style="text-align:left"
<fo><line pattern="empty"/></fo>

xslfostyle="border:1pt solid black; background-color:silver; text-align:center; font-size:12pt;"  >
    <item literalSpaces="true" field="TotalBruto" xslfostyle="font-size:10pt" width="4.5cm"/>

<fo><line pattern="empty"/></fo>


ClassMethod CriaXML(ByRef params)
    set data="Data: "_$ZD(+$H,4),dc="|"
            !,"<Orcamento>",!,"LISTA ESTOQUE DE PRODUTOS",!,"</Orcamento>"
             !,"<CabDesc>",!,"Descricao Produto","</CabDesc>"

            !,"<GrItens>"      ; tem q criar l?? em cima o grupo dos itens 
            FABR=$o(^NEFAL(CEMP,FABR)) ; busca o 1o item do pedido 
            while FABR'=0 {
            while DIVI'=0 {
            while LINHA'=0 {
            while NOME'="" {
            while CPRO'=0 {
            set contitem=contitem+1
            !,"<TotalBruto>",!,"Total Bruto.:",$j($FN(TOTAL/100,".",2),15),!,"</TotalBruto>"


ClassMethod %OnPreHTTP() As %Boolean
        Set %response.Timeout=900
        Quit 1

2 0 4 1,037


  1. Try setting RenderTimeOut and PrintTimeOut properties for the report.
  2. Check logfile (you can determine directory in which it gets created by instantiating the report and calling GetRootDir method, but usually it's a value of the ^%SYS("TempDir") global, unless you specify ReportDir property or parameter).

You may want to consider reading up on SPLITANDMERGE which is designed to address large reports.  

"The PDF output for a very large report may exceed the memory restrictions of the FOP rendering engine. In this case, you can split the report into several smaller sections. Each section is written to disk as a separate temporary file, and merged into a single PDF file once the entire report has been processed. "

Looking at your xml structure you may be able to define the repeating element to be <GrItems>.  Note while I do not believe you are including page numbers in your ReportDisplay, but if you do I do believe it does not produce the desired result when using SPLITANDMERGE.

Did you ever run the $LOG=1 option to see what additional error details there are? This would be the first step because it might not be a timeout issue but maybe an issue with the actual data itself (invalid xml characters for example).  When running a zen report directly, the data retrieval and data display processes need to complete within the CSP gateway timeout setting. Sometimes this isn't possible, that's why Zen reports supports the split/merge option as well as having a number of Generate to file methods (because they are being written to a file, these methods are not impacted by the timeout).