Retrieve the data from the SAP database using the select statement and the where clause.
For database programming writing queries to retrieve the data from SAP database is essential. This is achieved with the help of the SELECT statement. There are various ways of writing the SELECT statement and we have given you a few examples below. The most essential part of the SELECT statement apart from the syntax is that the data should be selected as per the desired result. There should not be any redundancy also the efficiency of the query should be taken care of, that means the report should run quickly in the most efficient way without overloading the system.
SELECT *
INTO wa
FROM (name) CLIENT SPECIFIED
WHERE mandt = '000'.
WRITE: / wa-carrid, wa-carrname.
ENDSELECT.
SELECT *
INTO wa
FROM scarr UP TO 4 ROWS.
WRITE: / wa-carrid, wa-carrname.
ENDSELECT.
Variants:
1. SELECT [SINGLE [FOR UPDATE] | DISTINCT] *
2. SELECT [SINGLE [FOR UPDATE] | DISTINCT] s1 ... sn
3. SELECT [SINGLE [FOR UPDATE] | DISTINCT] (itab)
Please check the following discussion on Selecting a single row.
No comments:
Post a Comment