cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create a Functiona Query

Former Member
0 Kudos

Dear all,

Could any body detail me how to create a functional query. Please give me step by step procedure to create a query.

I would appreciate if you can give me a material with screen shots. Your help will be highly appreciated.

Thank you

Raghu Ram

Accepted Solutions (1)

Accepted Solutions (1)

former_member204513
Active Contributor
0 Kudos

Hi Raghu,

Go through this document it may help you,

SAP Query

Step 1: Create User Group – SQ03

Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > User Groups

a) In the User Group: Initial Screen -

Enter User Group Code (self named)

Click on “Create”

b) In the User Group (Code): Create or Change pop-up window -

Enter the User Group Description

Click on “Save”

c) In the Create Object Directory Entry pop-up window -

Ö Click on “Local Object” button

Ö The User Group Created is saved

Step 2: Create User Group – SQ02

Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > Infosets

a) In the Infoset: Initial screen -

Ö Enter Infoset Code (self named)

Ö Click on “Create” button

b) In the Infoset: Title & Database Screen -

Ö Enter Description of Infoset in the “Name” field

Ö In the Data Source selection: Select appropriate Data Source by clicking

the radio button

· Source the data can either be multiple tables OR single table. There are 4

options for the user to select from

Ö Click on “Continue” (Enter)

Ö Selected Table gets displayed in the Infoset : Initial Screen

c) In the Infoset: Initial Screen -

Ö Click on “Insert Table” button

d) In the Add Table Screen -

Ö Enter the Table Name that is to be inserted

Ö Click “Continue” (Enter)

e) In the Infoset: Initial Screen -

Ö Click on “Back” button

f) In the Field Group Defaults pop-up Screen -

Ö Select Appropriate Field Group Option by clicking on the radio button

· there are 3 options to select from. User can select Empty Field Group

option and then select the data fields in the steps explained further.

Alternatively, User can select an option which clubs all the data fields

From all the tables selected

Ö Click “Continue” (Enter)

g) In the Change Infoset Screen -

· the left side lists the Tables that the user has selected in step b, c & d

· In the right side, system creates field groups, one for each table listed in the

left part. Initially, the Field Groups are empty

Ö In the Left Side, Click on the arror next to the table name and expand and

display all the data fields in the table

Ö Select a Data Field from the expanded Table view, which is to be added to

the Field Group on the right.

Ö Select a Field Group on the right side, in which Data Field selected above

has to be added

Ö Right click on the Data Field selected and click on “Add Field to Field Group”

Ö The selected Data Field gets added to the selected Field Group, which is

indicated by an arrow next to the Field Group.

Ö Carry out the steps above to add the required Data Fields to the respective

Field Groups

Ö After transferring Data Fields to Field Groups click on “Generate” button

h) In the Create Object Directory Entry Screen -

Ö Click on “Logical Object” button to generate the infoset

i) In the Change Infoset Screen -

Ö Click on the “Back” button

j) User is taken back to the “Infoset: Initial Screen” which displays the

created Infoset record.

Step 3: Assigning User Group to Infoset – SQ03

Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > User Groups

a) In the User Groups: Initial screen -

Ö Enter the User Group for which Infoset is to be assigned

Ö Click on “Assign Users & Infosets” button

b) In the User Group: Assign Users Screen -

Ö Click on “Assign Infosets” button

c) In the next screen, select the Infoset, which needs to be attached to the

User Group selected

d) Click on the “Back” button

Step 4: Creating Query – SQ00 & SQ01

Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > Queries

a) In the “Query from User Group: Initial Screen -

Ö Click on “Other User Groups” button

Ö In the pop-up screen, User Groups, select the User Group for which the

Query has to created. The pop-up screen closes.

Ö Enter the Query Code in the “Query” field

Ö Click on “Create” button

b) A pop-up screen “Restrict Value Range” shows the list of Infosets assigned to

the User Group

Ö Select the Infoset for which Query has to be created

c) In the new screen Create Query: Title, Format -

Ö Enter the Description of the Query in the “Title” field

Ö Click on the “Next Screen” button

d) In the Select Field Group” screen

Ö Select the Field Groups from which Data Fields have to be selected for the

Output

Ö Click on the “Next Screen” button

e) In the “Select Field” screen -

Ö Select the Data Fields, which should appear in the output

Ö Click on the “Next Screen” button

f) In the Screen “Selection” -

Ö Select the Data Fields for the selection criteria

Ö Enter the sequence in which the selected fields would appear in the input

screen of the query.

Ö Define if the selection criteria should be Single Value or Multiple Value Range

by clicking in the appropriate check boxes

Ö Click on the “Basic List’ button

g) In the screen “Query Layout Design” -

Ö Select the Output Fields from the Data Fields section by clicking the

appropriate check box

Ö Change the sequence of Data Field columns if required

Ö Click on the “Test” button to test the query created

h) On the “Test Query” screen click “Continue”

i) In the “Query” screen -

Ö Enter the selection criteria

Ö Click on “Execute” button

j) Save the Query created

Step 5: Running the Query – SQ00

a) In the Query From User Group: Initial screen –

b) Click on “Other User Groups” button to select the User Group

c) In the pop-up screen “User Groups” select the User Group

d) System lists all the queries created for the User Group

e) Select the appropriate Query

f) Click on “Execute” button

g) User is taken to the Selection screen

h) Enter the selection criteria and click on “Execute” button

i) System runs the query and gives the output

Regards,

Murali.

Answers (2)

Answers (2)

Former Member
0 Kudos

The QuickViewer is a new product that is actually a variant of the standard query maintenance transaction. It contains the following new features:

  • The reports created using the QuickViewer are called QuickViews. They have the same functional properties as queries, but only basic lists may be defined.

  • User groups are no longer necessary in the QuickViewer. All users have their own personal supply of QuickViews that cannot be passed between different users. You may, however, convert QuickViews to queries and then assign them to a user group.

  • Functional areas are no longer a requirement when defining QuickViews. When defining a QuickView you must initially specify a data source. This data source may be a table, a database view, a table join, a logical database, or a functional area that already exists.

  • The QuickViewer has two different modes for creating QuickViews Basis mode and Layout mode. In basis mode, only those fields you want to use in the report are selected (including sort fields and selection fields) and your report's graphical layout is determined by the tool you choose to display it in (Excel, ALV, as a list, etc.). In layout mode, the Query Painter described above is used to layout your list.

  • The QuickViewer uses several different controls and can only be used if your system meets the appropriate hardware and software requirements.

Use transaction code SQVI to call the QuickViewer. You can also use the menu option System -> Services -> QuickViewer.

The initial screen of the QuickViewer is similar to the initial query maintenance screen. You will find an additional window at the left of your screen containing help texts. You may change the size of this window using your mouse. You can call existing QuickViews for processing by selecting a QuickView directly from the table or by entering its name in the appropriate input field. Then choose the function Change.

To create a new QuickView you enter a new name in the input field and choose Create . A dialog box appears where you must make the following entries:

  • Title (long text) and remarks, if you so desire

  • Type of data source (table/database view, table join, logical database, functional area)

  • Name of the data source

At this point different kinds of entries may be expected from the user depending on the type of data source selected. Use the possible entries pushbutton for a list of possible data sources.

  • Mode (basis mode or layout mode)

If you have chosen a table join as your data source, the join must be defined before you can begin with QuickView definition. During join definition, a control is made available to users allowing them to visualize the relationships between the individual tables. The join definition procedure will be described in depth below.

If you have chosen a functional area as your data source, the functional area must come from the standard area. Functional areas from the global query area may not be used in QuickView construction.

If you have chosen basis mode for defining you QuickView, a screen is displayed containing a tab strip with three tabs where you can make all of the necessary entries pertaining to the fields you want to display. Here you determine which fields are to be displayed, which fields you want to use as sort fields, and which fields should be used as selection fields. Each tab contains a table on the left with those fields selected and a table on the right containing all fields available for use. The table on the left may contain additional infomation about the fields selected depending on how the are to be used (display, sorting, selection).

To choose a field, select it in the table on the right and use the pushbutton Arrow pointing left to move it to the other table. To deselect a selected field, select it in the table on the left and use the pushbutton Arrow pointing right to move it back to the table on the right. You can select and move more than one field at a time. In addition, pushbuttons exist that allow you to move all of one table's fields to the other.

You can select a field in the selected field list on the left and use the pushbuttons to the left of this table to move the field up or down in the field sequence. This allows you to determine the display or sort sequence of these fields depending on which subscreen (tab) you are currently on. The sort subscreen also has pushbuttons allowing you to alter the sort direction (ascending or descending).

In addition, basis mode contains a selection field with dropdown box that allows you to choose which tool you want to display your list in (Excel, ABAP List Viewer, as a list, etc.).

If you want to design your list's layout yourself and choose layout mode instead, the graphical Query Painter described above appears instead of these tab strips.

Regarding your question where it will be used, supposing you have to generate a report based on the customer sales area, if the despatch details has to be generated, you have to use SQVI and table join KNVV (for sales area) and VBRP (for despatch details).

Hope this explanation is suffice and reward suitably.

Former Member
0 Kudos

hello, friend.

well, if by functional query you are referring to query using ABAP tables, you can try using SQVI (t-code).

when you execute this, the initial screen appears. enter your file name (preferably starting with "Z") and click "create". on the next screen, enter the table name, or select "table join" if you want to work with 2 or more. if you chose "table join", you will insert tables in the next screen.

you will be brought to the next screen (basis mode). in the "list fld selec" tab, choose the field data you want to display. go to the "sort sequence" tab to click on the fields relevant to sorting. go to "selection fields" to choose which ones are relevant for parameter search.

execute.

hope this helped.

regards.