Download PDF copy for any report
Sometime, client may ask some tool to be able to download report output (be it classical, ALV grid or list) to PDF. One of customer asked us to enable them to download PDF thereby restricting it’s staff activities. I have made efforts not to restrict its applicability and maintain generality.
This functionality is encapsulated in a Function module and encompasses following action.
- Prepare job name.
- Schedule job in background and read latest spool.
- Introduce wait period of 120seconds to let the job complete.
- Download PDF locally with spool number as input upon completion of job.
Steps to be carried out in target report:
- Prepare selection table.
- Call function module on click of button ‘PDF Download’ added to toolbar.
There are few things you should keep in mind:
- Selection criteria should be filled in the selection table as it appears in selection screen.
- In case of ALV generation using FM ‘REUSE_ALV_GRID_DISPLAY’ do remember to pass parameter ‘SLIS_PRINT_ALV’ to suppress list info like no of records appearing in PDF (ls_print-no_print_listinfos = ‘X’).
- An endless loop in a report can result in unexpected result (Including long running job).
At bottom I have included an example how to implement in your report.
Please provide your suggestion/inputs and like it if it is helpful.