If you need to provide an SSRS report with a multiple company selection, you can opt for a cross-company query. In this case, such an option will be maintained by the system automatically. (You can try this [SrsReportQuery(queryStr(LogisticsEntityLocationUnion))])
But what if you need to do that without the former? In this case you'll need to use LedgerLegalEntityLookup class as follows. Say we deal with some mgcSalesBySegment report, which is meant to return some data for a given selection of legal entities.
I hid some not relevant code; so that you can get the gist.
Data contract mgcSalesBySegmentContract: we keep the user selection of companies as a string.
Report controller mgcSalesBySegmentController: if no companies selected, let's set it to the user's context.
User interface builder mgcSalesBySegmentUIBuilder: when an SSRS report runs, it shows its dialog twice: the second time in the report viewer, when the report is rendered. Thus we have to override dialog methods in the UIBuilder class to avoid the lovely 'Object reference not set to an instance of an object' error.
Report data provider mgcSalesBySegmentDP: we need just to convert the saved string back to a container, then we can loop through it as required by the report logic.