I need to download a spool to a PDF document. I have a report that prints out certain information. This report can be run in the background. If it does run in the background the user has the option (checkbox on selection screen) to select to download the report into a PDF document.
In the ABAP code, it checks this checkbox. If set, it calls functions CONVERT_OTFSPOOLJOB_2_PDF or CONVERT_ABAPSPOOLJOB_2_PDF using SY-SPONO (spool id). The problem that I'm getting is that the PDF document doesn't contain all the pages i.e. the last few pages.
I suspect that this is because the spool is still being written to when the function is called to download to pdf document. I've tried putting in a commit work statement before calling the function but knew that it will never work and it proved right. I can only think of putting a wait statement of say 5 seconds before calling this function, however there might be a better way.
Is there a better way? Is there another way of ensuring that the spool is written to completely? Or am I on the wrong track here and there is another reason on why I'm not getting the last few pages in the pdf document.
As usual all help would be appreciated in the form of points.
Thanks and regards,