Generating reports in SAP NetWeaver with FastReport (tutorial)- Part 1
“Fast Report Inc” is a world – known company producing very fast and scalable reporting components for different platforms. Two years ago “Fast Report” presented a solution for SAP NetWeaver AS ABAP based systems. The solution includes components for ABAP stack, SAP GUI for Windows and a dedicated server for report generation.
In three parts of my blog I will demonstrate and examine the main development steps according to different scenarios.
Part 1: Rapid report development
- SAP NW 7.31 or higher;
- Workstation with SAP GUI for Windows;
- Fast Report.Net components installed on SAP NW (demo version can be requested via follow link https://www.fast-report.com/en/product/fast-report-net-sap/).
Build report for the current stock of materials. EPM Demo data model is data source for report.
Final report example:
Prepare a Data source.
To be able to create a new report it is needed to use SAP Query for report data source.
Run transaction SQ02 and switch the namespace to local. It is worth using a local namespace as it does not require transport requests and it is possible to build queries directly in the production system.
Create new Infoset ZZDEMO_STOCK and choose the table SNWD_STOCK as a basis table.
Add tables and join them as it is shown in the picture below
Press on “Infoset” button. On the overview screen add (drag and drop) data fields to a new result field group.
Save and generate infoset.
Run the transaction SQ03 and create a new user group “ZZDEMO_FR – Reports “. Assign infoset ZZDEMO_STOCK to the user group.
Save the user group.
Preparing a template
Now, let us study the solution presented by Fast Report! Turn on the transaction ZFR_COCKPIT. On the left panel select node Local->Reports-ZZDEMO_STOCK and then press the button “Call query” to turn on Infoset Query.
Mark the fields relevant to selection screen and report data source. Save the query with the name “Stock01- Stock overview”.
After the saving a new query will appear in the “tree”. Now, click on it and press “add report” on the right. On the bottom of the screen there are report parameters. Set a running type as “Run on frontend” and save the data.
After saving report parameters press the “Edit” button and then “Designer”. Selection screen with report parameters will appear. Execute the report and a Fast Report designer will be opened.
Adjust the report options:
Menu: Report->Options->General->Double pass.
Menu: File->Page setup->Columns->Count->2.
Menu: Report->Configure bands.
Configure (add\remove) bands as presented on the screenshot
Press the “Close” button.
Double click on 1st level group header band and put “[MYDATASET.CATEGORY]” as group condition.
Double click on 2d level group header band and put “[MYDATASET.PRODUCT_ID]” as group condition.
Double press on Data band and choose “MYDATASET” as data source.
Place the report elements:
Choose “text element” from the Element toolbar and place it on the Report title band. Double click on it and put the follow text in it “Stock on [Date]”.
From “Data” view drag “Category” to the first level group header band. From “Data” view drag “Product_id”, “TEXT” to the second level group band.
From “Data” view drag “ORG_UNIT_NAME”, “BIN_NUMBER”, “QUANTITY” to the “DATA” band. Double press on “QUANTITY” element and add “[MYDATASET.QUANTITY_UNIT]” to it.
On the report footer place “text element” from element toolbar and put the following text: “Page [Page] of [TotalPages]”.
User and Developer manual for designer can be found here: https://www.fast-report.com/en/product/fast-report-net/documentation/
There is a picture of the final template below:
Press the “Preview” button to view the results (in designer mode source data is restricted up to 100 rows).
Save the report (for this, press the “SAP” button) and leave the designer.
Now press “Run report” to run the report and to see the results.
Sometimes “preview” can be opened in background. In this case use “Alt+Tab” to switch between windows.
To use this report as a standalone (without ZFR_COCKPIT), it is needed to create a separate transaction for it.
Run the transaction SE93. Then, enter any transaction code you want (for example, ZZDEMO_STOCK), add short text and choose “Transaction with parameters” as a start object.
On the next screen put “ZFR_RUN” as transaction code. Then, check “skip initial screen” and in “Default values” table add field “p_rep” and value <your report ID>.
Save the data.
Now, you are able to run a report directly by calling the transaction ZZDEMO_STOCK.