Custom actions in report header - get selected records

Custom actions in report header - get selected records

I have created a custom action for a report with 

a. Display Type - Show action in report header
b. Execution Type - Execute action for collection of records.

I want to write a custom function to take some action on selected records in the report. For eg. to send a mass sms with the selected to records in a single call.

I would like to know how to get the selected records.

Is this possible? Any example?