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: Functional areas Queries User groups
ABAP Query Functional Functional Areas Areas User User Groups Groups

Queries Queries

Each Query can have three type of reports or Lists, Basic Lists Statistical List Ranked List
Statistical Statistical List List Basic Basic List List Ranked Ranked List 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 roups

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 Maintain Queries Maintain Functional Areas Menu Path Tools p ABAP Workbench p Utilities p ABAP Query pSAP Queryp Queries Tools p ABAP Workbench p Utilities p ABAP Query pSAP Query p Functional Areas Tools p ABAP Workbench p Utilities p ABAP Query pSAP Query p User Groups

Maintain 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 adhoc queries, lobal 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

enerated

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.

Create Create a a functional area functional area Assign Assign required required fields fields to to functional functional groups groups Generate Generate the the functional functional area area

These are the main steps that need to be followed for preparation of an ABAP Query.

Create Create a a 4Trained Employee Available? user user group group

A functional area defines the tables and the fields within those tables, which can be queried on. Functional areas use a logical database or a direct read from a table, or a series of table joins to determine the available tables. <2 Functional groups: It is Part of a functional area. You create functional groups within a functional area and then assign the fields you want to query on to the functional group.

Assign Assign the the functional functional area area to to the the user user group group

Create Create the the query query

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 an Click 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 additional table another Additional tables required can be for selected here. condition key, you will need to Enter a valid table name and Press enter. make use of Alias table. ive 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 select Additional Field check reference using text fieldbox. 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.

Create Create a a functional area functional area Assign Assign required required fields fields to to functional functional groups groups Generate Generate the the functional functional area area

These are the main steps that need to be followed for preparation of an ABAP Query.

User groups link users to functional areas and queries and control the functional areas and queries a user can access. A user group is a collection of users that work with comparable data and accomplish similar tasks. Changes to functional areas and queries are immediately visible to all users linked. The users assigned to a user group can only access the functional areas assigned to their user group.

Create Create a a 4Trained Employee Available? user user group group

Assign Assign the the functional functional area area to to the the user user group group

Create Create the the query query

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.

Create Create a a functional area functional area Assign Assign required required fields fields to to functional functional groups groups Generate Generate the the functional functional area area

These are the main steps that need to be followed for preparation of an ABAP Query.

Create Create a a 4Trained Employee Available? user user group group

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 can select only one functional area/Infoset. If appropriate authorizations are in place, you can execute, modify, copy, and delete queries. Any modifications to queries affect all users of a user group.

Assign Assign the the functional functional area area to to the the user user group group

Create Create the the query query

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 which describe what the The graphical Query Painter allows younotes, to define lists in WYSIWY Enter the number of lines to be output on one query does mode (what you see is what you get). this tool may only be used to of This field determines thepage maximum number page. If you do not want breaks, leave this create basic lists. Statistics and ranked lists must be defined Query can be executed only with a variant characters which can be displayed on field empty. Valid range of numbers forone thisline Query is locked. This prevents other users from according to the old procedure. The graphical Query Painter uses of the created the query. Lines exceeding field islist 10 to 99. by making anycause changes to the query. this length line breaks. settings use several different controls. The unser menu option The Standard title appears at the top ofcan every This field determines the maximum number of2 choose Settings to change this option. page when print the list. This consists of List will notyou be displayed in the normal format Enter the length of andate, output line in characters for the width of a table view control. lines. Themaximum first line contains the the query on execution of the query . The First sub sublist is this field. You can use table number view controls to display title and theto page while the 2nd linethe is transferred the ABAP list viewer directly. On execution the query the statistics list is displayed data of singlesingle-of line basic lists, and an underscore line. The list is not displayed on processing the on the screen. All the lists for a query are Since line breaks do not apply to ranked lists rankings in a special format. Please note that Thus when a basic list and statistics list is query, but the first sub sublist is passed directly to List is passed not displayed on to ABC in usual Analysis. form, The the format list displayed in this case. and statistics, the number ofof columns for the this specification affects only the visible width. Standard title is output only you print the list ABAP list is directly passed to the Executive created, while processing SAP List viewer the graphic. needs of first to sub subbe -list either depends a basic, on statistics table view orcontrol. ranked List generated on execution of the query is entire query report is increased automatically. A table view control may contain more data using the execute and print function on the Information System(EIS). displays only one of them (whichever is set The first sub sublist is passed to the download list. passed for word processing. If you select this field, theat list is query not displayed columns than are visible once. selection screen or process the inthe first) interface and stored asin a file. The first numeric field the first line of list Parameter is set on the selection screen on but on the screen when you execute the query, background. Parameter is set on the selection screen on is used a point for the graphic choosing this field. Parameter is set on the selection screen on the firstas sub sub-reference list is passed directly to EXCEL choosing this field. Parameter is set on the selection screen on a display. When this checkbox field is selected, choosing this field. (via the XXL interface). parameterthis is predefined on the selection choosing field. 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. o 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