Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SQ02 - Create InfoSet using 'Data retrieval by program'

scurry888
Participant
0 Likes
1,960

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.

1 REPLY 1
Read only

Former Member
0 Likes
800

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.