Skip to Content
author's profile photo Former Member
Former Member

ABAP QUERY STEPS

Hi Friends,

can i send me Creation of ABAP QUERY...

REGARDS,

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 05:59 PM

    What Is SAP Queries



    Many times a need arises for SAP Users and Functional Consultants to generate quick reports without getting any ABAP coding done – time taken to complete the coding in development, transport and test it in QA system and then transport to production – is sometimes too long. In such cases, ABAP/4 query is a tool provided by SAP for generating these kind of reports.

    Type of Report Desired:


    Before starting to write an ABAP query, its advisable to decide the type of report that the user wants. ABAP query provides the following type of reports:

    Basic List Simple report
    Statistics Report containing statistical functions like Average &Percentage
    Ranked List Report written for analytical purpose

    The output is always seen in the order of Basic List, then Statistics and then Ranked List if any. One ABAP query can have one basic list, maximum of 9 statistics and maximum of 9 ranked lists.

    In a nutshell, an ABAP/4 query can be designed in four steps
    - Creation of a user group
    - Creation of functional area
    - Assignment of user group to functional area
    - Creation of the query based on functional area

    The various objects that form an ABAP query can be created in the following 2 ways:
    - Tools => ABAP/4 Workbench => Utilities => ABAP/4 Query

    OR

    - By executing the transaction codes mentioned below:

    SQ01 ABAP/4 Query
    SQ02 Functional Area
    SQ03 User group

    Step I - Create Functional Area
    In the functional area section, the user indicates from which part of the SAP database the data is going to be retrieved and how the data is to be retrieved by the query. One functional area can be assigned to many user groups. A functional area can be created with or without a logical database. To create a functional area with a logical database, one has to mention the name of the database and then select the fields from the tables that form the logical database.

    ABAP Query Authorizations: To use an ABAP query, the user must have appropriate authorizations. Two ways of providing authorizations to the users are as follows:

    - User groups
    The user should be a part of at least one user group to run the corresponding ABAP query. This automatically restricts the access of the user to specific functional areas, and thus the corresponding underlying logical databases.

    - Authorizations
    The authorization object S_QUERY should be used to give proper authorizations to the user for a query. This authorization object has a field named ACTVT which can take values 02 for Change, 23 for Maintain and 67 for Translate.

    This value determines whether the user can create and modify the query. The possible authorizations in the object are as follows:

    S_QUERY_ALL Change, maintain and translate query
    S_QUERY_UPD Change and Translate

    Though the general concept of an ABAP query is moderately difficult, the results and the long term use of the ABAP query is worth the effort.



    Creating the ABAP Query



    To create the query use the menu path Environment => Queries

    · Give a name to the query and click on the Create button

    · Give the description of the query in the next screen. Specify the output length and select the processing option from the Further Processing Options box. The data can be displayed in various formats such as table, download to a file, and display in Word etc.

    · Click on the Next screen icon. Select the functional group screen. All the functional groups created in the functional area are displayed. Select the groups that you desire – fields from only these groups will be displayed in the output. Click on the respective check boxes and click on the Next Screen icon.

    · The Select Field screen gets displayed. Select all the fields from the user group that you need to display on the output of the query. If required, specify the short names for the fields using the menu path Edit => Short Names => Switch On/Off or you can also change the selection text contains in the order you want to appear on the selection screen. You can also maintain column headers for the fields by using the menu path Edit => Column Header => Maintain.

    · Click on the Next Screen icon to get the Selections Screen. Here you can check against the fields that you require to be shown on the selection screen.

    · Now we need to specify the output type for the query as Basic List, Statistics or Ranked List. Choose the option Basic List.

    · On the Basic List line structure screen the following things can be done

    o Specify the report layout in detail – lines on which the fields will appear.

    o Order in which the fields will appear in the output

    o Sort order for the fields – this is optional.

    o For the numeric fields you can check against the fields for which you require totals in the output.

    o Beautify the output according to the options provided.

    · Click on the next screen icon, to specify the control levels as mentioned below

    o Specify the sort order. The default sort order is ascending and can be changed to descending if required.

    o Totals for each field selected for sorting can be displayed

    o To display the output of a field in a box click on the check box against box. To display a line after the output of a field, click on the check box against BlnkLn

    o To display the output of a field on a new page click on the check box against New Page

    · Click on the next screen icon to get the List Line options Screen. Here you can specify the background color for displaying the output.

    · Click on the next screen icon to get the Field Output Option screen. In this you can specify the following:

    o Change the output length or the display positions of the fields

    o Specify the display position of the unit for quantity or currency fields. Click left radio button to display it before the figure, middle radio button to display it after the figure while last radio button to hide the unit altogether.

    o Specify color for the column of every field under the Format option.

    o Specify the label against the output of sort fields.

    · Click on the Next screen option to go to the Basic List Header screen. Here you can specify

    o Give page header and page footer for the output

    o Include user name and date by specifying &N and &D respectively.

    After providing all the above options you can save the query and execute it by clicking the Execute button twice

    Regards,

    Maha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:33 PM

    Hi Venu,

    Step-by-step guide for creating ABAP query

    http://www.sappoint.com/abap/ab4query.pdf

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.