14
qwertyuiopasdfghjklzxcvbnmqwertyui opasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer tyuiopasdfghjklzxcvbnmqwertyuiopas dfghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq wertyuiopasdfghjklzxcvbnmqwertyuio pasdfghjklzxcvbnmqwertyuiopasdfghj klzxcvbnmqwertyuiopasdfghjklzxcvbn mqwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasdf ghjklzxcvbnmqwertyuiopasdfghjklzxc vbnmqwertyuiopasdfghjklzxcvbnmrty uiopasdfghjklzxcvbnmqwertyuiopasdf ghjklzxcvbnmqwertyuiopasdfghjklzxc vbnmqwertyuiopasdfghjklzxcvbnmqw Statistical Query http://abap-tutorials.com

SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

  • Upload
    lenhu

  • View
    232

  • Download
    5

Embed Size (px)

Citation preview

Page 1: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

qwertyuiopasdfghjklzxcvbnmqwertyui

opasdfghjklzxcvbnmqwertyuiopasdfgh

jklzxcvbnmqwertyuiopasdfghjklzxcvb

nmqwertyuiopasdfghjklzxcvbnmqwer

tyuiopasdfghjklzxcvbnmqwertyuiopas

dfghjklzxcvbnmqwertyuiopasdfghjklzx

cvbnmqwertyuiopasdfghjklzxcvbnmq

wertyuiopasdfghjklzxcvbnmqwertyuio

pasdfghjklzxcvbnmqwertyuiopasdfghj

klzxcvbnmqwertyuiopasdfghjklzxcvbn

mqwertyuiopasdfghjklzxcvbnmqwerty

uiopasdfghjklzxcvbnmqwertyuiopasdf

ghjklzxcvbnmqwertyuiopasdfghjklzxc

vbnmqwertyuiopasdfghjklzxcvbnmrty

uiopasdfghjklzxcvbnmqwertyuiopasdf

ghjklzxcvbnmqwertyuiopasdfghjklzxc

vbnmqwertyuiopasdfghjklzxcvbnmqw

Statistical Query

http://abap-tutorials.com

Page 2: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

Creating Statistical QUERY

Creating Statistical Query is a three phase activity .

The first activity is creation of USER GROUPS using transaction SQ03

The Second activity is creation of INFOSET using SQ02

The last and the final activity is creation of QUERY using transaction SQ01

Let us see each of these activity in detail

A) Creation of USER GROUPS using transaction SQ03

Go to transaction SQ03

The following screen pops up

Page 3: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

Type the name of the user group you want to create ( for example – SALES ) and click on the create icon .The following

screen pops up

On clicking on Save icon your USERGROUP get stored .

B) Creation of INFOSET using transaction SQ02

This is second and one of the most important activity in statistical query creation . In this activity you follow the

following steps .

Go to transaction SQ02 .

Page 4: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

The following screens pops up

You type a name for the INFOSET you are going to create and click on the create icon. The following menu pops up

Fig : A

Page 5: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

If you are just going to print selected field from a table select “Direct read of table “

If you going to get consolidated information from more than one table, you select option “Table join by basis table “

In either of the above 2 case, give the name of basic table in the space provided and click on the continue icon.

Automatically the following screen pops with the field of the basis table you have mentioned as shown below

Page 6: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

You select/ insert the other tables you want using the icon “ Insert Tables “ . The screen looks like as shown below

Page 7: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

Please note that if the tables are standard SAP tables , the joining rule definition is proposed automatically . Else the

user has to create Join definition by clicking on the corresponding fields in related table and then dragging one from one

table to the other field in the other table . These Join definitions thus defined can be checked by using root JOIN > CHECK

LINK COND .

On establishing the join definition , you click on the back icon to save . The following menu pops up

Now you generally select option “Create Empty Fields Groups “ and click continue button . The following menu pops up.

Page 8: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

You either delete or create more Field Groups by using root Edit> Field Group > Create fields group .

Page 9: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

You then add required fields from the various tables by following steps

a) click on the Drop down icon , to get list of fields b) Select the required field c) Drag the field from the left side to Right side field group . Finally the field group looks like as shown below . d) Then you save the INFOSET

[ Please Note that if the fields are preceded by icon it means that only field value will get into the field group and if they

are preceded by icon it means that both field value and text will get into the field group ]

Then you check for any inconsistencies using root Infoset > Check

Then you generate the Infoset using root Infoset > Generate

The this generated Infoset is assigned to User group ( existing ). ( Refer Fig A in page 3)

Page 10: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

C) Creation of Satistical QUERY using transaction SQ01

Goto Transaction SQ01 . Select the appropriate USER Group .

Type the name of query (15 characters) and click on create icon .The following screen pops up.

Page 11: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

Select the appropriate INFOSET and click on the choose button .The following screen pops up.

Page 12: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

Then you go to the root GOTO>FIELD SELECTION> SELECT FIELD GROUP and select the appropriate field group.

Page 13: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

Then you go to the root GOTO>FIELD SELECTION> SELECT FIELD to select the field that you need in the report. You select

the required fields and click on “ Basic List “, where you list the line number , sequence number and sorting order for the

output . This is one of the most important activities in creating Statistical QUERY.

Then you go to the root GOTO>FIELD SELECTION> SELECTION to select the field that you need in the selection screen.

You select the required fields for selection and allocate number to the same. Also you specify whether multiple entries are

allowed or not by using “Sngl” field. If you tick the “Sngl” field then only single entry is allowed

Page 14: SAP Statistical Query - ABAP · PDF fileopasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer ... Query is a three phase ... standard

http://abap-tutorials.com 2010

Save the query and execute the report. Thus a query has been created.