ABAP QUERY
Abstract
This white paper gives a brief introduction on advanced ABAP concepts and detailed steps to create ABAP Query.
ABAP Query
Table of Contents
1. INTRODUCTION...........................................................................................................................3 2. ABAP QUERY................................................................................................................................4 3. CONCLUSION..............................................................................................................................10
Page 2
ABAP Query
Advanced ABAP Concept ABAP Query
This white paper gives a brief introduction on advanced ABAP concepts and detailed steps to create ABAP Query. Before getting into that in detail, lets start with basic overview of ABAP.
1. Introduction
1.1 Basics of ABAP
SAP (System Application & Products) is one of the best ERP Applications in the market. The application has been assembled in such a versatile way that it handles the entire functional department within an organization. Today major companies including Microsoft and IBM are using SAP to run their own businesses. A very high level programming language created by SAP is ABAP (Advanced Business Application Programming) which is used to develop applications for SAP R/3 system, a widelyinstalled business application subsystem. ABAP is thus not only a mature language that has proven itself in the practical field, but on the basis of its evolutionary strategy it continues to be suited to the requirements of business programming. With the quality of its application programs, it has made SAP a world leader in the development of business software.
1.2 Advanced ABAP
Following are the advanced topics, among these we are going to deal with ABAP Query, ABAP Query ALE, IDOC BADI Logical Database LSMW ABAP Code Optimization RFC and BAPI SAP Workflow
Page 3
ABAP Query
2. ABAP Query
2.1 Definition
ABAP Query is a functional tool used to develop simple report by writing queries instead of writing ABAP report program i.e. without ABAP coding. All you need is to join the table and drag and drop field that you wish to occur in the report. Following are the types of reports developed by ABAP Query Tool, Basic List: - This is a Simple report. Statistics: - Report containing statistical functions like Average & Percentage Ranked List: - Report written for analytical purpose.
2.2 Creation of ABAP Query
There are three steps for creating ABAP Query, Create User Group (SQ03):- Specify the users who should be authorized to run the query. Create Infoset (SQ02):- 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. Create Queries (SQ01):- Create the query and arrange the layout.
2.3 Case Scenario
Let we learn the creation of ABAP Query with a scenario of generating Purchase Order Detail Report. The report has following details, Purchase Document Number Company Code Document Category Document Type Status Payment Term Material Number Plant Storage Location Order Quantity Unit of Measure
Page 4
All the above information is stored in the base tables EKKO (Purchasing Document Header) and EKPO (Purchasing Document Item).
2.4 Step by Step Approach
Step by step approach of creating ABAP query is as follows,
2.4.1 Create User Group
Navigate to SQ03 to create User Group. Give name of the user group and click on Create. The below picture is the snapshot of User Group: Initial Screen where Z_USER_GRP01 is the name of the user Group.
Once the user Group is created, users have to be assigned to this group. The users in the group are only eligible to run the query. The below screen shows DEV01 and DEV02 users are added to this user Group.
2.4.2 Create Infoset
Infoset holds the information about the query i.e. the tables used, fields needed, join condition etc. Navigate to SQ02. Give the name and click on Create. Provide the Title and the table information in the fields provided as given in the below screen.
Till now EKKO table is only added in the infoset, now EKPO table has to be added by clicking on Insert Table button in the below screen. Once both the tables are added, the pictorial representation of the tables are represented as, Insert Table
Select Fields: - This is achieved by clicking on Infoset Button on previous screen. Fields are selected by simply dragging and dropping from left to right. Here we have selected only 6 fields from EKKO table and 5 fields from EKPO table.
Generate the Infoset by clicking on Generate Button. Once the infoset is generated it will be displayed in the list with its status marked as Green.
Assign Infoset to the User Group which we have created.
2.4.3 Create ABAP Query
Navigate to SQ01 and click InfoSet Query button for selecting the infoset under which the query has to be created.
Among the selected fields in the infoset, select the fields for outputting in the report as well as selection condition can also be given for each and every field before the report is generated. This is shown in the below screen,
Final report is generated by clicking on Output Button in the previous screen. This is the sample report for Basic list similarly Statistical and Ranking list can be generated by selecting the option from the dropdown provided in the previous screen.
3. Conclusion
This document gives brief introduction on ABAP concepts and stepwise approach to create ABAP Query. It is basically a tool to test SQL query. It clearly depicts that, report program is not needed to test the single SQL Query.