ABAP / 4 QUERY
ABAP / 4 QUERYABAP / 4 QUERY
ABAP / 4 QUERYABAP / 4 QUERY
OBJECTIVE
The objectives of this Power Point Presentation are
To explain what ABAP Query is.
To explain the terms User Group, Functional Area and Functional Group.
To explain through sequence of screen shots the steps involved in creating a functional area with and without a logical database and attaching a functional group to the functional area created,creation of User Group and assignment of functional area to the User Group and finally create the Query based on the Functional Area created.
ABAP / 4 QUERYABAP / 4 QUERY
ABAP/4 Query is a powerful tool to generate simple reports without the need for any coding.
A very handy tool for the functional consultants who don’t have any prior programming experience.
Steps to create an ABAP/4 Query.
Create an user Group.
Create a functional area.
Assign the User Group to the Functional Area.
Create the Query based on the Functional Area created.
User GroupUser Group
Within a team or department, the problems solved using ABAP/4Query reports are fairly similar and involve the same functional areas. ABAP/4 Query has been designed to allow you to combine users withsimilar concerns together in user groups.
The members of a user group can use all programs (queries) created byany user of the group.
Changes to such a program are at once visible to all users. This ensuresthat all members of a user group use the same evaluation programs.
Functional AreasFunctional Areas
ABAP/4 Query allows you to evaluate data in the R/3 System. Since theR/3 System contains several hundred thousand fields in logicaldatabases, tables and sequential datasets, it is simply not practical tooffer all these fields to the user for selection when creating queries.
Therefore, before starting to create queries you create functional areas .Functional areas provide the user with a framework for defining a queryquickly and without difficulty.
Functional GroupFunctional Group
A functional group combines related fields together into a meaningfulunit. It provides you with a preselection so that you do not have to searchthrough all fields of a logical database just to produce, for example, asimple list of flight connections.
This means that the end-user only has access to precisely those fieldsassigned to a functional group.
Fields must be assigned to a functional group before they can be used inqueries.
Functional Group Functional Group
You can assign fields of different tables to one functional group. In thisway, you can treat fields of linked additional tables and also additionalfields in the same way as true logical database fields.
ABAP / 4 QUERY ABAP / 4 QUERY
CREATING A FUNCTIONAL AREA WITH A LOGICAL DATABASE
To create a Functional Area goto
Tools->ABAP/4 Workbench->utilities ->ABAP/4 Query->Functional Areas or use SQ02 transaction.
Assign a Functional Area name and Click on Create button.
In the next screen give a description to the functional area.A functional area can be created with a logical database or without a logical database.
In the Functional Area with Logical database box specify the logical database name (e.g. Database : F1 Application : S. This is the SAP defined flight database).
ABAP / 4 QUERY ABAP / 4 QUERY
Click on Functional Groupbutton on the application toolbar to create the functional group for the fields from the tables in the logical database.
Window : Change Functional Area <Functional Area name>
In this screen in the Functional Groups box mention the functional Group number and description (e.g 01-Flight, 02-Demo, 03-Bookings etc.).
Tables of logical database / Joins show the tables from the logical database.The fields from the tables are displayed in the Fields box.
To change the list double click on the table name.
In the fields box against the fields specify the functional group number in which you would like to include the field.
ABAP / 4 QUERY ABAP / 4 QUERY
Repeat the above step for the fields from each table.To get the list of the fields from other tables select the table in the Tables from logical database / Joins box and double click.
Save the Functional Area and Generate it.
ABAP / 4 QUERY ABAP / 4 QUERY
CREATE A FUNCTIONAL AREA WITHOUT A LOGICAL DATABASE
To create a Functional Area choose
TOOLS->ABAP/4 WORKBENCH->UTILITIES->ABAP/4 QUERY->FUNCTIONAL AREAS
Assign a Functional Area name and Click on Create button.
In the next screen give a description to the functional area.
In the functional Area without a Logical database area give the base table name.
Check the table join check box and click on the table join button.
ABAP / 4 QUERY ABAP / 4 QUERY
In the joined tables area give the table names which you want to include in the join condition .
The base table name will be grayed out. Now select two tables by selecting the check boxes for defining the join condition.
To define the join conditions choose EDIT->Join->Define condition.
You will see mapping between the tables on the right side under the Join Conditions area.Click on the button (with + and down arrow symbol) to specify the join between the tables
You will get a message “Proposals Requested”.Click on Yes.
In the next screen that you get, if there is a foreign key relationship defined between the tables then you will see 00 = 00 (signifying the join) displayed against the common fields of the tables else you can specify the join yourself by typing in 00 or 01 etc.
ABAP / 4 QUERY ABAP / 4 QUERY
Click on Back arrow button to come back and continue defining the conditions for more tables if required.
Click on Functional Group button on the application toolbar to create the functional group for the fields from the tables in the logical database.
Window : Change Functional Area <Functional Area name>
In this screen in the Functional Groups box mention the functional Group number and description (e.g 01-Flight, 02-Demo, 03-Bookings etc).
Tables of logical database / Joins show the tables from the logical database.The fields from the tables are displayed in the Fields box.
To change the list double click on the table name.
In the fields box against the fields specify the functional group
ABAP / 4 QUERY ABAP / 4 QUERY
number in which you would like to include the field.
Repeat the above step for the fields from each table.To get the list of the fields from other tables select the table in the Tables from logical database / Joins box and double click.
Save the Functional Area and Generate it.
ABAP / 4 QUERY ABAP / 4 QUERY
CREATING A USER GROUP
From the menu bar choose ENVIRONMENT->USER GROUP.
In the next screen give a user group name.
In the user Group, specify the names of the users who are authorized to use this functional area / query.
Click on Create button.
Give a description to the user group and specify the names of the users.
Click on the Assign Functional Area button on the toolbar to assign the functional area to the user group.
Save the User group .
ABAP / 4 QUERY ABAP / 4 QUERY
CREATING A QUERY
To create a query choose Environment->Queries.
Assign a Query name and Click on Create Button.
Select the functional area for the user group by double clicking it.
In the next screen give a description to the query,specify the output length (if required) and select the processing option from the further processing options box. You display the data as a table, download it to a file,display in a word processor etc.
Click on the Next Screen icon (->) on the toolbar.
SELECT FUNCTIONAL GROUP screen.
ABAP / 4 QUERY ABAP / 4 QUERY
The list of Functional Groups that were defined in the functional area is displayed. Select the ones required. The fields from this group will only be displayed in the next screen.
Click on the Next screen icon (->) on the toolbar.
SELECT FIELD screen.
The fields from each functional groups is displayed. Select the fields that you want to include in your query report. Here in this screen, you can do the following if required:
You can specify Short names for the fields. Choose EDIT->SHORTNAMES->SWITCH ON/OFF.
You can also change the selection text contents to the way you want it to appear in the selection screen.
ABAP / 4 QUERY ABAP / 4 QUERY
You can also create local fields that you would like to include in this query only. You have to give a short name for the local fields that you create.
Choose EDIT->LOCAL FIELD->CREATE.
You can include fields such as user name, system date,time etc.
You can also maintain column headers for the fields. Select the filed and then choose EDIT->COLUMN HEADER->MAINTAIN.
Click on the Next Screen icon (->) on the toolbar.
SELECTION SCREEN. In this screen click on check boxes against the fields.
Now select the query Report type (Basic List, Statistics or Ranked List) that you want to generate.
ABAP / 4 QUERY ABAP / 4 QUERY
Create a Functional Area
ABAP / 4 QUERY ABAP / 4 QUERY
Give a description and assign a logical database
ABAP / 4 QUERY ABAP / 4 QUERY
Show the nodes of all the tables
ABAP / 4 QUERY ABAP / 4 QUERY
Assign Data Fields to the Field Group
ABAP / 4 QUERY ABAP / 4 QUERY
Save and generate the Functional Area
ABAP / 4 QUERY ABAP / 4 QUERY
Create a User Group
ABAP / 4 QUERY ABAP / 4 QUERY
Give a description for the User Group
ABAP / 4 QUERY ABAP / 4 QUERY
Click on Assign User and InfoSets
ABAP / 4 QUERY ABAP / 4 QUERY
Click on assign Infosets
ABAP / 4 QUERY ABAP / 4 QUERY
Click on the Functional area and save
ABAP / 4 QUERY ABAP / 4 QUERY
Create a Query
ABAP / 4 QUERY ABAP / 4 QUERY
Click on the User Group
ABAP / 4 QUERY ABAP / 4 QUERY
Give a Description for the Query
ABAP / 4 QUERY ABAP / 4 QUERY
Click on the Functional Group
ABAP / 4 QUERY ABAP / 4 QUERY
Click on the Fields
ABAP / 4 QUERY ABAP / 4 QUERY
Click the required selection fields
ABAP / 4 QUERY ABAP / 4 QUERY
Click on Basic List
ABAP / 4 QUERY ABAP / 4 QUERY
Click on Header and give a description
ABAP / 4 QUERY ABAP / 4 QUERY
Click on Footer and give a description
ABAP / 4 QUERY ABAP / 4 QUERY
Click on the required datafields
ABAP / 4 QUERY ABAP / 4 QUERY
Selection Criteria Screen
ABAP / 4 QUERY ABAP / 4 QUERY
Execute the Query
ABAP / 4 QUERY ABAP / 4 QUERY
Functional Groups Creation Using Table Joins
ABAP / 4 QUERY ABAP / 4 QUERY
Insert Table
ABAP / 4 QUERY ABAP / 4 QUERY
Select Include All Table Fields Radio Button
ABAP / 4 QUERY ABAP / 4 QUERY
Save And Generate Functional Area
ABAP / 4 QUERY ABAP / 4 QUERY
Create User Group
ABAP / 4 QUERY ABAP / 4 QUERY
Give A Description For The User Group
ABAP / 4 QUERY ABAP / 4 QUERY
Click Assign Users And Infosets
ABAP / 4 QUERY ABAP / 4 QUERY
Assign User And Click Assign Infosets
ABAP / 4 QUERY ABAP / 4 QUERY
Assign Functional Area To User Groups
ABAP / 4 QUERY ABAP / 4 QUERY
Save User Group
ABAP / 4 QUERY ABAP / 4 QUERY
Create Query
ABAP / 4 QUERY ABAP / 4 QUERY
Assign Functional Area
ABAP / 4 QUERY ABAP / 4 QUERY
Give Description For The Query
ABAP / 4 QUERY ABAP / 4 QUERY
Select Field Groups
ABAP / 4 QUERY ABAP / 4 QUERY
Select Required FieldsSelect Required Fields and Click Next Button
ABAP / 4 QUERY ABAP / 4 QUERY
Click Basic List Button
ABAP / 4 QUERY ABAP / 4 QUERY
Create Header And Footer
ABAP / 4 QUERY ABAP / 4 QUERY
Select Data Fields Required for Display
ABAP / 4 QUERY ABAP / 4 QUERY
Execute Query
ABAP / 4 QUERY ABAP / 4 QUERY
Selection Criteria Screen
ABAP / 4 QUERY ABAP / 4 QUERY
Output For The Query
ABAP / 4 QUERY ABAP / 4 QUERY
SUMMARY
The following topics were discussed in the above Power pointPresentation.
ABAP Query in a nutshell.
Creation of Functional area with a SAP Logical Database F1S.
Attaching a User Group to the Functional Area created and then creating a Query to the Functional Area Created.
Creation of Functional Area without a logical Database and then attach a Functional Group by specifying the required Join conditions.
Attaching a User Group to the Functional Area created and then creating a Query to the Functional Area Created
ABAP / 4 QUERY ABAP / 4 QUERY
Exercise
Ex 1 : Creation of Functional Area with a Logical Database.
Input : Logical Data Base F1S.Using this Logical database create a functional Group and attach the functional group to the functional
area.
Create a User Group and assign the same to the Functional Area Created.
Finally create a Query and assign the same to the Functional Area.
Then create a Basic List and then Execute the Query.
ABAP / 4 QUERY ABAP / 4 QUERY
Exercise
Ex 2 : Creation of Functional Area without a Logical Database.
Input :Ex 2 : Creation of Functional Area without a Logical Database.
Input : Create a Functional Group by taking MARA as the Base Join Table in Functional Area creation.
Create a user group and attach the user group to the functional area created.
Create a Query and assign the functional group to the Query
Finally create a Basic List and then execute the Query.