‎2011 Nov 08 1:00 AM
Using SQ02, I would like to use the data returned by an ABAP program as the data source for an InfoSet. When attempting to create an InfoSet, I noticed the 'Data retrieval by program' option. I would like to discover how to use this option and how to pass parameters to the ABAP program I'd like to use.
‎2011 Nov 08 1:56 AM
The "Data retrieval program" would be coded like any normal report except for adding a few comment tags that will be used by SQ01 query generator as placeholders to insert its own code into your code to generate the query program.
In general this is how a data retrieval program is coded. SQ01 when it generates the query will insert its own code in place of *<Query_body> and *<Query_head> comment tags
REPORT ztest_sq01_driver_program.
TABLES: <name of dictionary structure of your infoset>.
* DATA declarations
START-OF-SELECTION.
*<Query_head>
* <Fetch your data here and store it in an internal table gt_report> that has all the fields that you need in your query
END-OF-SELECTION.
LOOP AT gt_report INTO gs_report.
MOVE-CORRESPONDING gs_report TO <name of dictionary structure of your infoset>
*<Query_body>
ENDLOOP.