SAP Knowledge Base Article - Public

1278874 - Having trouble passing variables from subreport to main report and creating grand totals.


Unable to pass variables from subreport to main report.

Reproducing the Issue

Environment Details:

Crystal Report Developer Version : Crystal Reports Designer XIR1 / XIR2 / 2008.

Operating System: Microsoft Windows XP / 2000 / 2003 Server / Vista.

Reproducing Steps:

  • Create a crystal reports using Xtreme Sample Database.
  • Use "Customer" table for the main report and insert a sub report and place the sub report in group footer.
  • Create a formula declare and initialize the value as shared variable in the subreport.

          Formula : 

                                 shared numbervar total:= 100;

  • Create a formula in the main report and declare the same shared variable and place the formula in the group footer next to the subreport.

          Formula : 
                                shared numbervar total;


When we use a shared variable in a particular section and pass this variable to the main report and display it in the same section, then we find that the variable does not pass the value as a shared variable.


To rectify the problem, ie) for the proper functioning of the shared variable we have to follow the below steps..

  1. Declare a variable as shared while writing the formula in a subreport and place the formula in the sub report

  2. Use the same variable in main report which was declared as shared in subreport.

  3. Insert a new section below the sub report and place the main report formula in the new section.

  4. Goto > Section Expert in the main report > Select the sub report section > Select "Underlay Below Section".

  5. Now create a manual running total using that variable.


Passing Variables, Subreport, Main report.  

, KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem


Crystal Reports 2008 V0 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2