Crystal Report Using Sub Reports
Purpose of the document
This document is useful for a new user of Crystal Report Enterprise 4.0.
Introduction
In this Part we will understand that how to create Crystal Report using a Sub Report in Crystal Report Enterprise 4.0.
A Work Book can contain many Reports in the Form of Tabs (Circled in the above screenshot). So we have to use the “Sub Report” concept in creation of CRE.
Prerequisites for the Creation of Crystal Report:
To start preparation of a CRE on a workbook we need a Main Report where we will attach the Sub Reports.
To refer this document the only prerequisite is user should have knowledge of SAP BEx (Business Explorer).
Here
we refer a workbook to prepare a Crystal Report using Sub Reports,
below are the steps that a user should follow to start work on Crystal
Report Enterprise 4.0.
Creation of Crystal Report:
Now to create the Main Report login to CRE 4.0 and Click on the File Tab then select the option “From Data Source”.
Then the below screen will appear and you have to select the intended “Data Source”
Then Click on Next Tab and select any one or two fields into the “Result Objects for Query” Screen.
Then click on Finish Tab and execute this Main Report.
Then click on the Structure Tab (Circled).
Then right click and delete the fields. Now use the “Sub Report” Concept.
Then insert sections in Body Portion so that we can insert our reports as Sub Reports.
Inclusion of Sub Reports:
Then click on the “Sub Report” Tab and place the Sub Report into the Body Section.
Then the below screen comes where you have to use the Using Existing Report option and browse the Sub Report that you want to add here.
Note: Here I used an already prepared crystal report as a Sub Report.
You can also create a Sub Report in the Main Report via selecting option “Create a new report” on the above screen.
For creation of new sub report you should have the IDT connection.
Then select the required report via Browse option and click on the Open Tab.
Then the below screen comes where you have to click on the Next Tab. If you click on the ADD Tab then it
will show the filter on your main report (if it has) and you can link
that with the sub report. (Here the main report does not have any
filter)
Then on the Next screen you have to click on the ADD Tab then you will get the fields that will pass the data between the Main Report and the Sub Report through a Link.
So select the same fields in the Main Report and the Sub report Parameters and click on the Finish Tab.
Now your Sub report will appear into the Body Section.
Then Right Click on it and select the “Format Sub Report” Option.
Then give the Sub Report’s Name. To change the Sub Report you have to click on the Source Tab and Browse the report from Local Place.
If you choose On Demand option then only the Sub Report appears in the Page View (via Page Tab) and to get the data of that sub report you have to Double click on the Sub Report.
Usage of Tabs:
Sub Report: Using this tab you can choose the report that you want to add/replace as a Sub Report into the Main CRE.
When you click on the Source tab then it will take you to the file
selection window from there you can select your file.
When you click on Open the report will get affix on the Body section of the Main CRE.
General Tab: Here you can hide the sub report via writing formula.
If we select “Avoid Page Break” option here then the sub Reports will appear on the same page at structure level.
If we select the option of “Can Grow”
then the sub report can expand up to the size of the “Body” section of
the Main Report. Otherwise you have to manually adjust the size of the
sub reports.
Font Tab: Using font tab you can set the font type, size and other settings.
If you choose “Strike through” then the sub report’s name will be strike out at structure level.
Using option “Underline” the sub report’s name will be underlined at structure level.
Using “Alignment” option we can set that where the sub report will be aligned into the Main Report.
Appearance Tab: Using this tab we can set the border of the Sup Report.
If we choose the option “Close Border on Page Break” then the border will automatically get closed at the page end and the rest record will publish on the next page.
Section Level Setting: In the body section if you right click and select the option of “Format Sub Report”, then on the “Paging” option you can give the page orientation type that will help to view your report as per the size.
Here I selected “Landscape” as page orientation type because the number of columns is more in my report so the required width of the report is also more.
After successful execution of the report its output will be looks like the below screen shot.
Now you can move from one sub report to another by using the “Next Page” tab. (Circled Below)
Format Selection in CRE 4.0:
You
can also select the format in which you want to publish the report in
CRE 4.0 and can check if any change is required in your original crystal
report to support the required format.
Use the circled icon just below the Format tab and select the required format. (refer below screenshot)
After
selection of the format like “Export to PDF”, on the next window you
can select the number of pages of your report to check the publish
format and you can make this publish format as a default format for any
CRE.
Now when you click on the “OK” tab then on the next window you have to select the options regarding to save the report.
If you click on To file
tab then it will ask to store the file in the desired format and you
have to manually go to the stored place and open the report.
If you select To Application tab then the report gets open in Adobe Reader and then you can save it.
Now the report finally looks like: (in PDF format)