Report Inbox - NAV 2016 Any Help

Hi Folks -

I have been asked to create a report that will run through the Report Inbox table save the report as PDF and attach the report to email and send it to the user id in report inbox table. The help I need is to save the report as PDF, I am using 


Unfortunately I am not sure how to get the REC from the report inbox table. I have the report ID in the Report Inbox table but to save it as PDF how do I get the REC part. If I am on a Posted Sales invoice I know the record I am on but from Report ID I just don't know how to get the REC part.

Also, in the Report Output field in the Report Inbox table the report is saved in a BLOB field but again I am not sure how to extract the report from BLOB field and save it into a file.

Any help is highly..highly..appreciated.