SAP ABAP SELECT STATEMENT
Module Objectives
•Explain database Tables / data browser
•Use the SELECT statement and the WHERE clause
•Describe the SELECT SINGLE statement
•Explain the ORDER BY addition
•Describe retrieving individual columns
•Exclude duplicate records during selection
•Describe the SELECT statement syntax
•Define aggregate expressions
•Familiarization with ABAP 7.40 select statement new features
•Discuss performance and best practices
•SQL Console
SELECT Statement - Basic Form
the select statement is very simple in ABAP, we just use Keyword SELECT the we specified all columns of the table which we want to get we use * to show all columns with FROM keyword we specified the table. then we use a variable which will hold the result of the table and, in the end, we use ENDSELECT to end the select query.
Select Query |
Selecting specific fields from database table
Selecting specific fields from database table |
Inline Declaration after INTO for ABAP 7.40
instead of defining all the fields in ABAP 7.40 we can do inline declaration and its very easy and convient.
Inline Declaration |
Retrieving a Single Record - SELECT SINGLE
inorder to retrive a single record with query we use SINGLE keyword please check the below code to have a clear idea.
single record |
Select-options
inorder to select data based on range like date range or number range we have special query to handle such requirment, please check the example below.
Select-options |
Restricting Data Selection - WHERE clause
we can place condtion in select query using WHERE clause, so we can have a result based on our particular requirment.
Restricting data using Where clause |
SELECT INTO TABLE
using select into table we can easily populate the internal table using this keyword, to use this keyword we need to have structure of table ready please check the example below.
Select into table |
INTO CORRESPONDING FIELDS OF Table
New possible expressions
case statments are very usefull in query inorder to select specific values please check two examples to have a clear idea about case.
Case Expression |
SQL Expressions for JOIN
Column Specification
–In the SELECT list, you can specify all columns of a data source using the syntax data_source~* from 7.40, SP08 on. This can be handy when working with joins.Sql Expressions for Join |
-individual comparisons can be joined using OR .
Sql Joins |
For All Entries
instead of join join we can use All entries for keyword to join data of two tables.
For All Entries |
Performance
Performance report |
Select
Select use * only recommended when we are getting more than 90% of the fields and use aggregate function when applicable
From
Select from transparent tables and avoid cluster tables, find alternate transparent ones instead.
Into
Use INTO TABLE rather than INTO a work area if you are selecting more than 1 record. there is no performance issue with using INTO CORRESPONDING FIELDS.
WHERE
use a full key search if possible, otherwise, use an index of a partial key search if using for all entries make sure that the internal table is not empty and has no duplicate entries.
SQL Console in Eclipse
- The SQL Console is a powerful tool that helps the ABAP developers to work with Open SQL Select statement.
- It can display the result of select query without the need of ABAP programming.
- One can open more than one SQL Console and work parallel SQL Console any number of times.
Sap Abap Select Statement >>>>> Download Now
ReplyDelete>>>>> Download Full
Sap Abap Select Statement >>>>> Download LINK
>>>>> Download Now
Sap Abap Select Statement >>>>> Download Full
>>>>> Download LINK qd
Nice Blog..
ReplyDeletePersonal loan for CIBIL defaulter
Amazing article.
ReplyDeleteSingapore Wallpaper Shop
Great post.It seems to be interesting and gave me lot of information,Thank for sharing it.I am looking forward for new articles.keep it up.
ReplyDeleteInventory management software