Вы находитесь на странице: 1из 22

SAP R/3 Technique User manual : SAP Query

Date: 12 September, 2011

1.
1. 2. 3.
3.1.

TABLE OF CONTENTS
TABLE OF CONTENTS CHANGE HISTORY GENERAL
Analysis

2 3 4
4

4.

HOW-TO PROCEED
4.1. Create user group 4.1.1. Create user Group 4.2. 4.3. Create infoset Choose the Display-fields

5
5 5 6 8 8 9 10 11 12 12 13 16 16 17 18 18 21

4.4. Add additional fields 4.4.1. Add the fields 4.4.2. Add the code 4.5. Link infoset and user to user group

4.6. create the query 4.6.1. General 4.6.2. Output fields 4.6.3. Selection fields 4.6.4. Basic list layout 4.7. Link a transaction code to the query 4.7.1. Search program name 4.7.2. Link transaction code to query 4.8. Link hotspot

13 January 2010 Page 2

2.

CHANGE HISTORY

Date

Details

Author

Version

13 January 2010 Page 3

3.
3.1.

GENERAL
ANALYSIS

SAP (or ABAP) query can be used to generate reports on a rather simple way. This document is a very short manual on how-to create such a report. This document is not a complete manual, but rather a document that can be used as a guide.

13 January 2010 Page 4

4.

HOW-TO PROCEED
4.1. CREATE USER GROUP

A User group is needed to link certain users with the queries (which will be created later on) and generated reports. Transaction code : SQ03 Path : Tools ABAP Workbench- Utilities SAP query - SQ03

4.1.1. Create user Group

Fill in a name and click on Create

Fill in a description.

Choose package and transport request.

We will link the users and queries in a later stage

13 January 2010 Page 5

4.2.

CREATE INFOSET

Transaction code : SQ02 Path : Tools ABAP Workbench- Utilities SAP query - SQ02 There are two approaches to create an infoset : a. Infoset based on a logical database b. Infoset based on directly linked tables

a. Logical database Logical databases are special ABAP programs that retrieve data and make it available to application programs. A logical database provides a particular view of database tables in the R/3 System.

b. Linked tables. Use a table as head-table and link other tables afterwards.

First thing we have to do, is create the infoset. Fill in a name and click on create.

Fill in the data. For this example, well create a simple sales order list, so we take VBAK as table. This is the table with header data for sales orders. We take the option Table join using basis table because we will add other tables .

13 January 2010 Page 6

Add the other tables by clicking on edit insert table

For the example, we add following tables : VBAP : table with sales order items. KNA1 : main data for customers VBPA : table with link between the sales order item and partner function

13 January 2010 Page 7

Click on BACK (green arrow). Mark the option Create empty field groups.

4.3.

CHOOSE THE DISPLAY-FIELDS

On the left side, youll see the tables you have selected with all their fields. On the right side, youll see the already selected fields. You can add a field by dragging it from the left to the right. If necessary, change the column header from the field. When finished, click on save.

4.4.

ADD ADDITIONAL FIELDS

13 January 2010 Page 8

4.4.1. Add the fields


If needed, you can add additional fields to the report. (which can be filled up using ABAP code). We use the example which links the partner function code to the long text (e.g. AG -> bill-to party) Click on extra. Select the tab extras and create a new field

Tpart-vtext is the field in the database which contains the long text for the partner function name

13 January 2010 Page 9

4.4.2. Add the code


Select the additional field by clicking on it and click on the add code-button.

Select DATA . We define our variables here.

Go to record processing and add the code to read the added field.

Save your infoset.

DO NOT FORGET TO GENERATE THE INFOSET !! Infoset generate

13 January 2010 Page 10

4.5.

LINK INFOSET AND USER TO USER GROUP

Transaction code : SQ03 Fill in your name from the user group, and click on assign users and infosets. Fill in the persons which are allowed to execute the query and infosets. After that, click on assign infosets

Search your infoset and mark it. Click on save.

13 January 2010 Page 11

4.6.

CREATE THE QUERY

Transaction code : SQ01

4.6.1. General
Fill in the name and choose the infoset you want to use. Click on create. Fill in the needed info.

13 January 2010 Page 12

Click on next.

4.6.2. Output fields

Select the field groups where there are fields which you want to show in the output

13 January 2010 Page 13

Click on next.

Select the fields which you want to show

13 January 2010 Page 14

Click on next.

13 January 2010 Page 15

4.6.3. Selection fields


Mark the fields which you want to use as selection parameter.

Click on basic list.

4.6.4. Basic list layout


Mark the items which need to be displayed in the sequence that you want them to be showed. (mark tem under the field list fields)

13 January 2010 Page 16

On the right, youll see an example of how the output will be. Save and exit.

4.7.

LINK A TRANSACTION CODE TO THE QUERY

13 January 2010 Page 17

4.7.1. Search program name


We have to search the program name from the query. Do this by filling in the query name in transaction SQ01. (do not press Enter) Click on Query more functions display report name. Copy it.

4.7.2. Link transaction code to query


Go to transaction code SE93. Fill in the desired transaction code and click on create. 13 January 2010 Page 18

Fill in a short description and choose for program and selection screen

Fill in the program name. Mark the three options under SAP GUI.

13 January 2010 Page 19

13 January 2010 Page 20

4.8.

LINK HOTSPOT

You can link a transaction to the report which will open when you double-click on that line. Click on Go To -> Report Assignment

Add a line by clicking on the plus-sign

Choose Other report type

Click on Transaction

13 January 2010 Page 21

Fill in the transaction you want and click on Ok

13 January 2010 Page 22

Вам также может понравиться