To build print form of purchase order and generate it for document type “NB standard order”.
Prepare Data dictionary.
For PO output data we need to create structures in ABAP dictionary. These structures will be used in the report designer as data source.
Run transaction SE11. Create and activate the follow objects:
Table type ZZPO_ITEM_TT
Table type ZZPO_DOC_TT
Run transaction ZFR_RMAN.
Press on “New” button and add a new report “ZPO_FR” with parameters as presented on the screenshot
Save the report.
After saving switch into edit mode (press “Edit” button) and then press “Designer” button.
System will ask to enter Data source table. Enter ZPO_DOC_TT.
After confirmation Fast report designer will be opened.
Menu: Report->Configure bands.
- Configure (add\remove) bands as presented on the screenshot
Press on “Close” button.
- Double click on 1st level “Data” band and select “ITEMS” as data source.
- Double click on 2d level “Data” band and select “SCHD” as data source.
- Place report elements.
- Stretch “Report Title” band, place “text elements” from element toolbar and fill them with the static texts. Drag fields from “MYDATASET” data source table to the “Report Title”.
- Format “Page header” band to display items header ( add static text elements ).
- Format “Data: ITEMS” band - place fields from “ITEMS” table.
- Format “Data: SCHD” band - place fields from “SHDL” table.
- On “Footer” band place summary fields from “ITEMS” table ([ITEMS.MENGE] and [ITEMS.MEINS]).
User and Developer manual for designer can be found here: https://www.fast-report.com/en/product/fast-report-net/documentation/
If to press “preview” button - report will be empty because still no “test” data has been generated. Later we will see how generate temporary data and preview report with the data.
Save report template (press SAP standard button) and leave designer.
Now press “Save” to save\update report settings.
Develop print program and perform customizing
We need to develop program\routine to be able to call printing form from purchase order output function.
In ABAP Workbench create new module pool ZZMM_FRPRINTING.
Add subroutine “po_print_fr” with the follow code:
In the code we call function to retrieve PO information, then map the data to our structure and call method ZCL_FRBASE_REPORT->BUILD_REPORT for report generation. In case we need to debug form with test data - comment call of “BUILD_REPORT” method and uncomment section below.
Call transaction NACE and create new output type ZZFR for Purchase order. As printing program select ZZMM_FRPRINTING and routine PO_PRINT_FR. Choose access sequence 0001.
Add new output type to your output schema (for example RMBEF1)
Create condition record for condition type ZZFR and PO type NB.
Open follow settings path: SPRO->Material Management->Purchasing->Messages->Output control->Message types->Define message types for Purchase order-> Fine-Tuned Control: Purchase Order.
Add records for ZZFR
Now you can open existing purchase order or create a new one and test printing form using standard buttons in the transaction ME23N. Otherwise use transaction ME9F for printing.