Sometimes a situation arises when an ABAP query’s
automatic data retrieval facility is not enough to get the desired
results. In that case, the steps up to creating the functional area
are the same. Only difference is that on the Title and Database
screen specify a structure in the field Table and select the field
Data Retrieval Using Program.
The default report name given by the system can be
overwritten.
This report needs to be defined before hand – because
it is used as a model while generating the query report. Thus the
report itself remains unchanged but based on that another one is
created.
Note: Ensure that the report is free of syntax errors
and has the same fixed point arithmetic settings as the functional
area.
A typical report of this type will have the following
format:
Report
<report name>.
Tables:
<list of dictionary structures to be used>.
Parameters: <name of parameters>.
Select-options: <name of select options>.
Data: <
all internal tables>.
*<query
head> This comment should always be after data declarations.
Beginning of a loop to retrieve each record and place it in the
field string tab.
Select,
do-enddo, loop, etc.
<code
to format the data>.
*<query
body> This comment should always be the last statement in the loop.
At this
stage the data will come into the field string.
Endselect, enddo, endloop.

