ABAP语法讲解二(s e l e c t语句)

更新时间:2023-07-12 09:16:37 阅读: 评论:0

SELECT
Basic form语文论文
SELECT lect clau [INTO clau] FROM from clau [WHERE cond1] [GROUP BY fields1] [HAVING cond2] [ORDER BY fields2].
In an ABAP Objects context, a more vere syntax check is performed that in other ABAP areas. See Short Forms Not Allowed and * Work Areas Not Allowed.
Effect
Reads a lection and/or a summary of data from one or more databa tables and/or views (e relational databa). SELECT is an OPEN SQL statement.

Each SELECT statement consists of a ries of claus, each with a differen task:
The SELECT clau lect clau describes
Whether the result of the lection should be a single record or a table,
Which columns should be contained in the result,
Whether identical lines may occur in the result.
The INTO clau INTO clau determines the target area into which the lected data is read. If the target area is an internal table, the INTO clau specifies:
怎么打开罐头Whether you want to overwrite the contents of the internal table or
Append the results to the internal table, and
Whether you want to place the data in the internal table in a single step, or in a ries of packages.
The INTO clau can also occur after the FROM clau. You may omit it if
The SELECT clau contains a "*",
The FROM clau does not contain a JOIN, and
You have declared a table work area dbtab in your program using TABLES.
The data, if it exists in the databa, is then made available using the table work area dbtab. The statement is then procesd further like the SELECT * INTO dbtab FROM dbtab statement, which has the same effect.
If the result of the lection is a table, the data is normally read line by line (for further information, e INTO clau) in a processing loop, which is introduced with SELECT and concludes with ENDSELECT. The loop is procesd once for each line that is read. If you want the result of the lection to be a single record, there is no concluding 连衣裙英文ENDSELECT statement.
The FROM clau 笛子怎么吹FROM clau specifies the source of the data (databa tables or views), from which you want to lect the data. It also specifies the
口臭喝什么茶
Client handling,
Behavior for buffered tables, and
The maximum number of lines that you want to read.
The WHERE clau cond1 specifies the conditions that the result of the lection must satisfy. By default, only data from the current client is lected (without you having to specify the client field specifically in the WHERE clau). If you want to lect data from veral clients, you must u the ... CLIENT SPECIFIED接受美学 addition in the FROM clau.
The GROUP BY clau fields1 combines groups of lines into single lines of the result table. A group is a t of records with the same value of each databa field listed in the GROUP BY clau.
The HAVING clau cond2 specifies conditions for the combined lines of the result table.
The ORDER BY clau fields2 specifies how the records in the result table should be arranged.
The system field SY-DBCNT contains the number of lines read so far ecah time the SELECT statement is executed. After ENDSELECT, SY-DBCNT contains the total number of records read.

The return code is t as follows:
手机标识SY-SUBRC = 0:
The result table contains at least one record.
SY-SUBRC = 4:
The result table is empty.
深谋远虑的近义词SY-SUBRC = 8:
Applies only to SELECT SINGLE FOR UPDATE: You did not specify all of the primary key fields in the WHERE condition. The result table is empty.
Note
The SELECT COUNT( * ) FROM ... statement returns a result table containing a single line with the result 0 if there are no records in the databa table that meet the lection criteria. In an exception to the above rule, SY-SUBRC is t to 4 in this ca, and SY-DBCNT to zero.
Example
Displaying the pasnger list for Lufthansa flight 0400 on 2/28/1995:
DATA: WA_SBOOK TYPE SBOOK.

SELECT * FROM SBOOK INTO WA_SBOOK
  WHERE
    CARRID  = 'LH '      AND
    CONNID  = '0400'    AND
    FLDATE  = '19950228'
  ORDER BY PRIMARY KEY.
  WRITE: / WA_SBOOK-BOOKID, WA_SBOOK-CUSTOMID,
          WA_SBOOK-CUSTTYPE, WA_SBOOK-SMOKER,
          WA_SBOOK-LUGGWEIGHT, WA_SBOOK-WUNIT,
          WA_SBOOK-INVOICE.
ENDSELECT.
Note
Performance:
Storing databa tables in a local buffer (e SAP buffering) can lead to considerable time savings in a client/rver environment, since the access time across the network is considerably higher than that required to access a locally-buffered table.
Notes
1. A SELECT statement on a table for which SAP buffering has been declared in the ABAP Dictionary usually reads data from the SAP buffer without accessing the databa. This does not apply when you u:
- SELECT SINGLE FOR UPDATE or
- SELECT DISTINCT in the SELECT clau,
- BYPASSING BUFFER in the FROM clau,
- ORDER BY f1 ... fn in the ORDER BY clau,
- Aggregate functions in the SELECT clau,
- When you u IS [NOT] NULL in the WHERE condition,
or when the table has generic buffering and the appropriate ction of the key is not specified in the WHERE condition.

本文发布于:2023-07-12 09:16:37,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1078271.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:罐头   美学   标识
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图