Top Banner
ABAP / 4 QUERY
64

17-SAP Query

Apr 10, 2015

Download

Documents

api-3823432
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 17-SAP Query

ABAP / 4 QUERYABAP / 4 QUERY

Page 2: 17-SAP 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.

Page 3: 17-SAP Query

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.

Page 4: 17-SAP Query

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.

Page 5: 17-SAP Query

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.

Page 6: 17-SAP Query

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.

Page 7: 17-SAP Query

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.

Page 8: 17-SAP Query

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).

Page 9: 17-SAP Query

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.

Page 10: 17-SAP Query

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.

Page 11: 17-SAP Query

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.

Page 12: 17-SAP Query

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.

Page 13: 17-SAP Query

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

Page 14: 17-SAP Query

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.

Page 15: 17-SAP Query

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 .

Page 16: 17-SAP Query

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.

Page 17: 17-SAP Query

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.

Page 18: 17-SAP Query

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.

Page 19: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Create a Functional Area

Page 20: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Give a description and assign a logical database

Page 21: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Show the nodes of all the tables

Page 22: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Assign Data Fields to the Field Group

Page 23: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Save and generate the Functional Area

Page 24: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Create a User Group

Page 25: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Give a description for the User Group

Page 26: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on Assign User and InfoSets

Page 27: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on assign Infosets

Page 28: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on the Functional area and save

Page 29: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Create a Query

Page 30: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on the User Group

Page 31: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Give a Description for the Query

Page 32: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on the Functional Group

Page 33: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on the Fields

Page 34: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click the required selection fields

Page 35: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on Basic List

Page 36: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on Header and give a description

Page 37: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on Footer and give a description

Page 38: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click on the required datafields

Page 39: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Selection Criteria Screen

Page 40: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Execute the Query

Page 41: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Functional Groups Creation Using Table Joins

Page 42: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Insert Table

Page 43: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Select Include All Table Fields Radio Button

Page 44: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Save And Generate Functional Area

Page 45: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Create User Group

Page 46: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Give A Description For The User Group

Page 47: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click Assign Users And Infosets

Page 48: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Assign User And Click Assign Infosets

Page 49: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Assign Functional Area To User Groups

Page 50: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Save User Group

Page 51: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Create Query

Page 52: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Assign Functional Area

Page 53: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Give Description For The Query

Page 54: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Select Field Groups

Page 55: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Select Required FieldsSelect Required Fields and Click Next Button

Page 56: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Click Basic List Button

Page 57: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Create Header And Footer

Page 58: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Select Data Fields Required for Display

Page 59: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Execute Query

Page 60: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Selection Criteria Screen

Page 61: 17-SAP Query

ABAP / 4 QUERY ABAP / 4 QUERY

Output For The Query

Page 62: 17-SAP 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

Page 63: 17-SAP Query

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.

Page 64: 17-SAP 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.