You are on page 1of 29

ABAP Query is an easy-to-use reporting tool that lets you query data from

one or more database tables and funnel it into a list.

With this tool, you can extract data from virtually any application or database
table in the R/3 System.

ABAP Query enables you to create lists by moving through menus.

ABAP Query has three main components:  ABAP Query


ABAP Query
Functional areas      
Functional
Functional User
User
Queries        Functional
Functional
Areas
Areas
Queries
Queries
Queries
Queries
User
User
Groups
Groups
Areas
Areas Groups
Groups
User groups

Each Query can have three type of reports or Lists,

Basic Lists Statistical


Statistical
Statistical
Statistical
Basic
Basic
Basic
Basic
Ranked
Ranked
Ranked
Ranked
List List List
Statistical List List
List
List
List
List
List
List
List
List

Ranked List
Functional Areas
 
A functional area defines the tables and the fields within those tables,
which can be queried. Functional areas use a logical database, a direct
read from a table, or a series of table joins to determine the available
tables.

User Groups

User groups link users to functional areas and queries and control the
functional areas and queries a user can access. Each functional area is
assigned to one or more user groups. For access to ABAP Query, a user
must be a member of at least one user group.

Queries

When you create different lists using ABAP Query, you can save the
layout for each list. The element created is called a query. A query is
specific to a user group and functional area. When creating a query, you
may only select one functional area.
Basic list

Basic lists allow you to output data sorted by various criteria and to
calculate totals. This is the most common kind of report.

Statistical list

Statistics usually present data in condensed form, that is, numeric values
usually are totals or averages.

Ranked list

Ranked List are special types of statistics. Here, numeric values are also
summed for key terms and displayed in a table. However, sorting is always
by a numeric value known as the ranked list criterion. Additionally, only a
certain number of items are output. This makes ranked lists suitable for
analyzing questions such as: "What are the 10 flight connections with the
highest sales?“

A single query may have multiple statistical and ranked lists but only one
basic list.
To access the components of ABAP Query
ABAP Query Component Menu Path

Maintain Queries Tools  ABAP Workbench  Utilities  ABAP


Query SAP Query Queries
Maintain Functional Areas Tools  ABAP Workbench  Utilities  ABAP
Query SAP Query  Functional Areas

Maintain User Groups Tools  ABAP Workbench  Utilities  ABAP


Query SAP Query  User Groups

The output of ABAP Query can be:

Displayed on the screen in a table format


Displayed on the screen using SAP graphics
Downloaded to a spreadsheet (for example, Microsoft Excel) or a flat file
Saved as an extract that can be viewed later
Query Areas

A query area contains a set of query objects (queries, InfoSets, and user
groups) that are discrete and consistent

Standard Area

Standard area queries are client-specific, which are designed for ‘ad-
hoc queries,’

Global Area

In the global query area, queries are developed that are used
throughout the entire system, I.e. Cross-Client.

All query objects delivered by SAP (from Release 4.0) are located in
the global area. They can be identified by prefixes of these queries.
How Does ABAP Query Differ from Other Reporting Tools?

ABAP Query can access data from most tables within the R/3 System. Most
other reporting tools are limited to which tables they can access.

ABAP Query provides facility to have additional fields. Calculated value


could be stored in them. These fields are calculated on each line of a detail
report and then totaled by the specified fields (for example, material or
customer).

ABAP Query reports are typically simple listing and totaling reports, unlike
a balance sheet or an income statement which requires complex groupings.
Other tools (such as Report Painter/ Report Writer which uses sets for these
groupings) may be better suited for reports with complex groupings.
Display as Table

The Display as table function allows you to display Basic Lists, statistics and
ranked lists in tabular form with the help of the table view control facility. This
type of display does not include totals lines, sub-totals line and lines with
control level texts.

The advantage of this display over the list is that it gives you access to a
range of interactive functions. These include functions, which are
automatically provided by the table view control facility (e.g. column
switching, storage of settings, etc.). With other functions, you can manipulate
the displayed dataset by selecting lines and columns. The functions are:
Convert
Sort
Summing
Find
Show/Hide columns
Fixing columns
Print
Display list in original form
ABAP Program Generated
A query definition generates an ABAP/4 report with the name AQxxmmyy
where

xx stands for your user group identifier


mm stands for the client
For the clients 0 to 99, mm = 00 - 99.
For clients > 99, mm = a two-character key determined by the
system.
yy stands for the query name

Using Transaction SE38, this report can be developed further in the ABAP/4 Editor.
1 Create
Create aa These are the main steps that
functional
functional area
area need to be followed for
preparation of an ABAP Query.
2 Assign
Assign required
required fields
fields to
to
functional
functional groups
groups
1 A functional area defines the
tables and the fields within those
tables, which can be queried on.
3 Generate
Generate the
the Functional areas use a logical
functional
functional area
area database or a direct read from a
table, or a series of table joins to
Create
Create aa
4Trained Employee determine the available tables.
userAvailable?
user group
group
2 Functional groups: It is
<       
Part of a functional area. You
5 Assign
Assign thethe functional
functional area
area
to create functional groups within a
to the
the user
user group
group
functional area and then assign
the fields you want to query on to
6 Create
Create the
the query
query
the functional group.
Enter name of the Infoset/Functional Area to be
created.
Note that after the table is
inserted, the link or join
between them is displayed.
A message on the message line
will also confirm the insertion
of a table.

Press back to continue infoset creation


Every field in the table selected will be either a
normal field or a text field. Text field is the one
which has a text data along with it. E.g.
Sold_to_party is a text field which means that
the code and description of Sold_to_party
fields will be available for query preparation.

Every data source field is indicated with anClick Extras button to set
icon that tells you if it is a normal field or a additional information.
text field
You can choose additional table,
You can only use values for selection and additional fields, Additional
output with these fields Structure and code.

A text can be defined automatically for


every possible value of the field
Selection query for additional
table will be generated
automatically.

Multiple Additional Table


Assignments
Additional table Creation
In case you want to use the
same required
Additional tables additionalcan
table
be for another
selected here.
condition key, you will need
Enter a valid table name and Press enter. to
make use of Alias table.
Give an alias name to the same
table. Then select the table with
table name once and alias name
again for different conditions.
Enter description of the field
against Long Text.

The text entered against header


will appear in the report/query
list header column when the field
is selected.

Data type of the field can be


mentioned either by referencing
it to a SAP Table field or by
mentioning the data type and its
length.

Additional Field Creation In case ‘Determine LIKE


Mention table name and selectreference
‘Additional Field’
using check
text field’box.
is
selected and there is a text field
in relation to the reference field
mentioned it will be displayed
against ‘Text field’.

Sequence number is important


when there are more than one
additional fields and the
population of data in these fields
is interdependent.
Check the syntax and save the
coding.

Set selections using


selections icon.
1 Create
Create aa These are the main steps that need to
functional
functional area
area be followed for preparation of an
ABAP Query.
2 Assign
Assign required
required fields
fields to
to
functional
functional groups
groups 4 User groups link users to functional
areas and queries and control the
functional areas and queries a user
3 Generate
Generate the
the can access.
functional
functional area
area
A user group is a collection of users
Create
Create aa
4Trained Employee that work with comparable data and
userAvailable?
user group
group accomplish similar tasks. Changes to
functional areas and queries are
immediately visible to all users linked.
5 Assign
Assign thethe functional
functional area
area
to
to the
the user
user group
group
5 The users assigned to a user
group can only access the functional
6 Create
Create the
the query
query
areas assigned to their user group.
      
Choose Assign Infosets for
assigning infosets created.

User assignment screen is


displayed.

Enter user names and press save


icon or press CTRL+S.

Multiple users can be specified for


a user group.

If the checkbox next to User id is


selected, the user is authorized to
change or create a query. On
saving the users information
automatically the checkbox is
selected.

For removing users click


Select Infosets to be assigned
to this user group.

Save and press back button.


1 Create
Create aa These are the main steps that need
functional
functional area
area to be followed for preparation of an
ABAP Query.
2 Assign
Assign required
required fields
fields to
to
functional
functional groups
groups 6 When you create different lists
using ABAP Query, you can save
the layout for each list. The element
3 Generate
Generate the
the created is called a query. A query is
functional
functional area
area specific to a user group and
functional area. When creating a
Create
Create aa
4Trained Employee query, you can select only one
userAvailable?
user group
group functional area/Infoset.

If appropriate authorizations are in


5 Assign
Assign thethe functional
functional area
area
to place, you can execute, modify,
to the
the user
user group
group
copy, and delete queries. Any
modifications to queries affect all
6 Create
Create the
the query
query
users of a user group.
salesrep

All the infosets assigned to this user group will


be displayed in this window.

User should select an infoset and click choose.

Enter Query name and choose


create.
Long text for the Query should be entered. This
is a mandatory field.

Enter here
The graphical Query Painter allows younotes,
to definewhichlists
describe what the
in WYSIWYG
Enter
query the
doesnumber of lines to be output on one
mode (what you see is what you Thisget).
field this tool may
determines the only
maximumbe used
numberto of
page. If you do not want page breaks, leave this
create basic lists. Statistics and ranked
Query
field can be
characters
empty. lists
which
Valid must
executed
can
range be
beonly
of defined
with a variant
displayed
numbers on
forone
thisline
according to the old procedure. Query
The is locked.
graphical This prevents other
Linesuses from
users
of the
field islist
10 to 99. byQuery
created Painter
the query.
several different controls. Themaking
exceeding
unser
The
anythis
menu
Standard
changes
length
option
title
to
appears
the query.
cause atline
the breaks.
settings use
top can
of every
choose Settings to change this This field
option.
page when determines the maximum number ofof2
List will notyou print the list.
be displayed This
in the consists
normal format
characters
lines. The first for the width of a the table view control.
on execution ofline
thecontains
query . The First date, the
sub-list query is
You and
title can theusepage tablenumber
view controlswhile to display
the 2 nd
line the
is
transferred
On
Enter execution to the
of the ABAP query listtheviewer directly.
listoutput
is displayed
data
an ofthe maximum
single-line
underscore length
line.basic of an
lists, statistics line in
and
The
on
this list
the is not
screen.
field. displayed
All the on
lists processing
for a query arethe
rankings
Thus when in aa basic
special listformat. Please note isthatto
query,
List is
displayed
this
but in
passed
not the first
oncase.
displayed
specification this to in and
sub-list
ABC
affects usual
only
statistics
is passed
Analysis.
form,
the The
thelist
visible
directly
list
format
width.
Standard
ABAP
created,
the list
graphic. title
while is
is either output
directly
processing only
passed SAP of
to you
the
List print
Executive
viewer the list
needs
of
Listfirst
Since
A table to
sub-list
line be
generated
viewbreaks depends
on
control doa basic,
execution
not
may on statistics
applytable
containof the
to view or
query
ranked
more control.
ranked
datais
lists
using
The thesub-list
Information
displays
first execute
only one isand
System(EIS).
of print(whichever
them
passed tofunction
the on
downloadis the
set
list.
passed
and
If you
columns for
statistics,
select
thanword
thistheprocessing.
are number
field,
visibletheat of
list columns
is query
once. not for
displayed the
selection
first)
The
interface
first screen
numeric
and storedor process
field as ina the
file. the
first line ofin the list
Parameter
entire
on thequery
screenis set
report
when on the
isyou selection
increased screen
executeautomatically.
the query, on but
background.
Parameter
is used asthis is
a set on
reference the selection
point for the screen
graphic on
Parameter
choosing
the is
first sub-list set on
field. the selection
is passed directly to EXCEL screen on
choosing
display. When
Parameter this
is setfield.
thisoncheckbox
the selection fieldscreen
is selected,
on a
choosing
(via the XXL this field.
interface).
parameterthis
choosing is predefined
field. on the selection
screen.
Parameter is set on the selection screen on
choosing this field.
Control level is the grouping
level of the list appearing.

Control level details are


mentioned here. You can
modify the default setting of a
control level.

After you have completed


preparation of a query press
CTRL+S or Click on SAVE
Button
Ranked list name is mandatory.

Also mention the no. of places for number


of entries the ranked list should have.

Similar to the Statistics screen, mention


the sequence number for fields to be
displayed, select the field for ranked list
criteria and mentioned the unit against
numeric fields.

On pressing ‘Layout icon’ in the help texts


section, the layout of the ranked list is
displayed.

You can have more than one Ranked lists


for a query.

Save and press back to set the sequence.


If you want to display the remaining
sublist that are created. Go back and
select ABAP List and execute the query.

The first sublist set will be displayed, click


on the sub list query and select choose.

The required sublist query will be shown.

This feature is available only with ABAP


list option.

You might also like