<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Simple SELECT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301501#M502995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZWOP_TEST1 .

DATA :
  people TYPE STANDARD TABLE OF zpersonal.

SELECT nachn
INTO TABLE people
FROM zpersonal
INNER JOIN zintagral
ON zintagral~card = zpersonal~stredisko_aktual
WHERE zintagral~fili = '1200'
AND   zintagral~rdate = SY-DATUM.

LOOP AT people.
WRITE: /people-nachn.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;generates error: The internal table "PEOPLE" has no header line - explicit specification	of an output area with "INTO wa" or "ASSIGNING &amp;lt;fs&amp;gt;" is required.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 May 2007 08:19:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-24T08:19:31Z</dc:date>
    <item>
      <title>Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301481#M502975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I'm new to this forum so first I'd like to say hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to ask You how to write that SQL code in ABAP?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT people.name
FROM people, trips
WHERE people.name = trips.name
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:46:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301481#M502975</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301482#M502976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT name FROM people WHERE name = trips-name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Padmam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:52:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301482#M502976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301483#M502977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Piotr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Welcome to SDN.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can write Native SQL statements in ABAP using EXEC SQL...ENDEXEC statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL [PERFORMING &amp;lt;form&amp;gt;].&lt;/P&gt;&lt;P&gt;  &amp;lt;Native SQL statement&amp;gt;&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, if you want to have equalent code in ABAP for your requirement use JOIN statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;BEGIN OF IT_NAME,&lt;/P&gt;&lt;P&gt;NAME TYPE PEOPLE-NAME,&lt;/P&gt;&lt;P&gt;END OF IT_NAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT A~NAME&lt;/P&gt;&lt;P&gt;INTO TABNLE IT_NAME&lt;/P&gt;&lt;P&gt;FROM PEOPLE AS A INNER JOIN TRIPS AS B&lt;/P&gt;&lt;P&gt;ON A&lt;SUB&gt;NAME = B&lt;/SUB&gt;NAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:54:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301483#M502977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301484#M502978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Welcome To SDN!!!!!!!!..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can Write like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT name from people where name = trips-name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward All Helpfull Answers....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:56:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301484#M502978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301485#M502979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You dont need to specify the table name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply write :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                       SELECT &amp;lt;colname1&amp;gt;&lt;/P&gt;&lt;P&gt;                                     &amp;lt;colname2&amp;gt;&lt;/P&gt;&lt;P&gt;                                      ...............&lt;/P&gt;&lt;P&gt;                                      from &amp;lt;TABNAME&amp;gt;&lt;/P&gt;&lt;P&gt;                                      WHERE &amp;lt;if required&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:56:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301485#M502979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301486#M502980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types : Begin of t_trips,&lt;/P&gt;&lt;P&gt;                name type trips-name,&lt;/P&gt;&lt;P&gt;            end of t_trips,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            begin of t_people,&lt;/P&gt;&lt;P&gt;               name type people-name,&lt;/P&gt;&lt;P&gt;            end of t_people.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : i_people type standard table of t_people,&lt;/P&gt;&lt;P&gt;         i_trips    type standard table of t_trips.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select name &lt;/P&gt;&lt;P&gt;          from&lt;/P&gt;&lt;P&gt;          trips&lt;/P&gt;&lt;P&gt;          into table i_trips.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not i_trips[] is initial.&lt;/P&gt;&lt;P&gt;select name&lt;/P&gt;&lt;P&gt;          from&lt;/P&gt;&lt;P&gt;          people&lt;/P&gt;&lt;P&gt;          into table i_people&lt;/P&gt;&lt;P&gt;          for all entries in i_trips &lt;/P&gt;&lt;P&gt;         where name = i_trips-name.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_people will have all the required data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:57:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301486#M502980</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301487#M502981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Piotr, &lt;/P&gt;&lt;P&gt;          You can use SAP help itself to learn more about SELECT.&lt;/P&gt;&lt;P&gt;Any way the syntax for SELECT is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT result &lt;/P&gt;&lt;P&gt;       FROM source &lt;/P&gt;&lt;P&gt;       INTO|APPENDING target &lt;/P&gt;&lt;P&gt;       [[FOR ALL ENTRIES IN itab] WHERE sql_cond] &lt;/P&gt;&lt;P&gt;       [GROUP BY group] [HAVING group_cond] &lt;/P&gt;&lt;P&gt;       [ORDER BY sort_key]. &lt;/P&gt;&lt;P&gt;  ... &lt;/P&gt;&lt;P&gt;[ENDSELECT]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sarath&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if found useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:57:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301487#M502981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301488#M502982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just go through thois document. This will be useful for u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Syntax Diagram 
SELECT 


Basic form 
SELECT select clause [INTO clause] FROM from clause [WHERE cond1] [GROUP BY fields1] [HAVING cond2] [ORDER BY fields2]. 


In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Short Forms Not Allowed and * Work Areas Not Allowed. 

Effect 
Reads a selection and/or a summary of data from one or more database tables and/or views (see relational database). SELECT is an OPEN SQL statement. 

Each SELECT statement consists of a series of clauses, each with a differen task: 


The SELECT clause select clause describes 

Whether the result of the selection 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 clause INTO clause determines the target area into which the selected data is read. If the target area is an internal table, the INTO clause 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 series of packages. 



The INTO clause can also occur after the FROM clause. You may omit it if 

The SELECT clause contains a "*", 

The FROM clause 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 database, is then made available using the table work area dbtab. The statement is then processed further like the SELECT * INTO dbtab FROM dbtab statement, which has the same effect. 



If the result of the selection is a table, the data is normally read line by line (for further information, see INTO clause) in a processing loop, which is introduced with SELECT and concludes with ENDSELECT. The loop is processed once for each line that is read. If you want the result of the selection to be a single record, there is no concluding ENDSELECT statement. 



The FROM clause FROM clause specifies the source of the data (database tables or views), from which you want to select 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 clause cond1 specifies the conditions that the result of the selection must satisfy. By default, only data from the current client is selected (without you having to specify the client field specifically in the WHERE clause). If you want to select data from several clients, you must use the ... CLIENT SPECIFIED addition in the FROM clause. 



The GROUP BY clause fields1 combines groups of lines into single lines of the result table. A group is a set of records with the same value of each database field listed in the GROUP BY clause. 



The HAVING clause cond2 specifies conditions for the combined lines of the result table. 



The ORDER BY clause 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 set 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 database table that meet the selection criteria. In an exception to the above rule, SY-SUBRC is set to 4 in this case, and SY-DBCNT to zero. 



Example 
Displaying the passenger 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 database tables in a local buffer (see SAP buffering) can lead to considerable time savings in a client/server environment, since the access time across the network is considerably higher than that required to access a locally-buffered table. 



Notes 
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 database. This does not apply when you use: 
- SELECT SINGLE FOR UPDATE or 
- SELECT DISTINCT in the SELECT clause, 
- BYPASSING BUFFER in the FROM clause, 
- ORDER BY f1 ... fn in the ORDER BY clause, 
- Aggregate functions in the SELECT clause, 
- When you use IS [NOT] NULL in the WHERE condition, 
or when the table has generic buffering and the appropriate section of the key is not specified in the WHERE condition. 



The SELECT statement does not perform its own authorization checks. You should write your own at program level. 



Proper synchronization of simultaneous access by several users to the same set of data cannot be assured by the database lock mechanism. In many cases, you will need to use the SAP locking mechanism. 



Changes to data in the database are not made permanent until a database commit (see LUW) occurs. Up to this point, you can undo any changes using a databse rollback (see Programming Transactions). At the lowest isolation level (see lock mechanism ), the "Uncommitted Read", it can sometimes be the case that data selected by a SELECT statement was never written to the database. While a program is selecting data, a second program could be adding data to, changing data in, or deleting data from the database at the same time. If the second program then executes a rollback, the first program has selected a set of data that may only represent a temporary state from the database. If this kind of "phantom data" is unacceptable in the context of your application, you must either use the SAP locking mechanism or change the isolation level of the database system to at least "Committed Read" (see locking mechanism). 



In a SELECT - ENDSELECT loop, the CONTINUE statement terminates the current loop pass and starts the next. 



If a SELECT - ENDSELECT loop contains a statement that triggers a database commit, the cursor belonging to the loop is lost and a program termination and runtime error occur. Remote Function Calls and changes of screen always lead to a database commit. The following statements are consequently not allowed wihtin a SELECT-ENDSELECT loop: CALL FUNCTION ... STARTING NEW TASK , CALL FUNCTION ... DESTINATION , CALL FUNCTION ... IN BACKGROUND TASK , CALL SCREEN, CALL DIALOG, CALL TRANSACTION, and MESSAGE. 



On some database systems (for example DB2/390) 
locking conflicts can be caused even by read access. You can prevent this problem from occurring using regular database commits. 



Related 
OPEN CURSOR, FETCH und CLOSE CURSOR 


Additional help 
Reading Data 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 08:59:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301488#M502982</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T08:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301489#M502983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Piotr Wojciechowski ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Welcome to SDN!!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am giving simple codes to write SQL stmts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &amp;lt;fld_list&amp;gt; from &amp;lt;table&amp;gt; into &amp;lt;itab&amp;gt; where &amp;lt;conditions&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One easy way to learn is select SELECT keyword in ABAP and press f1 u will get help documentation or refer T Code ABAPDOCU for e.g. prgs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jogdand M B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 09:00:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301489#M502983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T09:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301490#M502984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select name &lt;/P&gt;&lt;P&gt;from people &lt;/P&gt;&lt;P&gt;for all entries in trips&lt;/P&gt;&lt;P&gt;where name = trips-name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 09:01:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301490#M502984</guid>
      <dc:creator>dev_parbutteea</dc:creator>
      <dc:date>2007-05-23T09:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301491#M502985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;syntax for select statement...&lt;/P&gt;&lt;P&gt;SELECT result &lt;/P&gt;&lt;P&gt;       FROM source &lt;/P&gt;&lt;P&gt;       INTO|APPENDING target &lt;/P&gt;&lt;P&gt;       [[FOR ALL ENTRIES IN itab] WHERE sql_cond] &lt;/P&gt;&lt;P&gt;       [GROUP BY group] [HAVING group_cond] &lt;/P&gt;&lt;P&gt;       [ORDER BY sort_key]. &lt;/P&gt;&lt;P&gt;  ... &lt;/P&gt;&lt;P&gt;[ENDSELECT]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;sathish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 09:16:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301491#M502985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T09:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301492#M502986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Welocme to SDN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Strusture for name&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Types : Begin of type_name,&lt;/P&gt;&lt;P&gt;              name like people-name,&lt;/P&gt;&lt;P&gt;            End of type_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table for name&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Data: itab_name type standard table of type_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Query&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;select p&lt;SUB&gt;name into table itab_name from people as p join trips as t on p&lt;/SUB&gt;name = t~name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sandeep&lt;/P&gt;&lt;P&gt;Reward if helpful &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 09:31:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301492#M502986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T09:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301493#M502987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for lots of replies. I'm really glad. I tried to simplify my problem, but I think that It'll be better to give You my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ZWOP_TEST1 .

TYPES : Begin of t_names,
          name type zpersonal-nachn,
        end of t_names.

DATA :  tmp TYPE t_names.


SELECT nachn INTO tmp FROM zpersonal
WHERE zintagral-card = zpersonal-stredisko_aktual.        ' here is the problem
  WRITE / tmp-name.
ENDSELECT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without WHERE line the code works and returns me names of people. But when I add WHERE line, I receive &amp;gt;Field "ZINTAGRAL_CARD" unknown&amp;lt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:07:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301493#M502987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301494#M502988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT people.name&lt;/P&gt;&lt;P&gt;FROM people, trips&lt;/P&gt;&lt;P&gt;WHERE people.name = trips.name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT name from people  into table itab  for all entries in trips where a&lt;SUB&gt;people = trips&lt;/SUB&gt;people.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helpful reward some points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;suresh babu aluri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:17:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301494#M502988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301495#M502989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;checkout the separator(_) , is it underscore or dash(-)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i guess it should be underscore(_)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zintagral&amp;lt;b&amp;gt;_&amp;lt;/b&amp;gt;card&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:21:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301495#M502989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301496#M502990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for replying profusely and I'm sorry for chaos in that topic. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could You explain to me the difference between ~ and -, because my workmate resolved our problem with code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZKNM_TEST1 .

TABLES: zpersonal, zintagral.

DATA: BEGIN OF pr,
  nachn LIKE zpersonal-nachn,
  fili LIKE zintagral-fili,
  rdate LIKE zintagral-rdate,
  rtime LIKE zintagral-rtime,
END OF pr.

SELECT zpersonal~nachn
       zintagral~fili
       zintagral~rdate
       zintagral~rtime
 FROM zpersonal
       JOIN zintagral
       ON zpersonal~stredisko_aktual = zintagral~card
    INTO CORRESPONDING FIELDS OF pr
    WHERE zintagral~RDATE = sy-datum
    GROUP BY zpersonal~nachn
             zintagral~fili
             zintagral~rdate
             zintagral~rtime.

    WRITE: pr-nachn, pr-fili, ' ' , pr-rdate, pr-rtime.
    ULINE.

ENDSELECT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It's not so important at this moment what do the code do. Almost all of You use &amp;lt;b&amp;gt;table-field&amp;lt;/b&amp;gt; notation. When i change ~ into - in code above it won't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 20:58:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301496#M502990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T20:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301497#M502991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;It is a simple JOIN query in ABAP too&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Declare an internal table to get the list of names.&lt;/P&gt;&lt;P&gt;data : int_people type standard table of people.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Fetch data&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;SELECT NAME&lt;/P&gt;&lt;P&gt;INTO TABLE INT_PEOPLE&lt;/P&gt;&lt;P&gt;FROM PEOPLE&lt;/P&gt;&lt;P&gt;INNER JOIN TRIPS&lt;/P&gt;&lt;P&gt;ON PEOPLE&lt;SUB&gt;NAME = TRIPS&lt;/SUB&gt;NAME&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 21:05:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301497#M502991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T21:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301498#M502992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And how can I Write the content of &amp;lt;b&amp;gt;int_people&amp;lt;/b&amp;gt; on the screen? Could You give me a tip?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 06:54:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301498#M502992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T06:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301499#M502993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;~ applies only to join queries:&lt;/P&gt;&lt;P&gt;If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor and ~ with the table name or a table alias.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever we use alias or a table name(in your example from zpersonal~nachn, zpersonal is a table name), we need to use ~.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In simple queries:&lt;/P&gt;&lt;P&gt;there is no confusion between fields as there is only one table, so we do not use any kind of alias or table name and we directly refer to the field name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT NAME&lt;/P&gt;&lt;P&gt;INTO TABLE ITAB_NAME&lt;/P&gt;&lt;P&gt;FROM PEOPLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We also use - to refer to fields of internal table or structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Logically, both mean the same thing but they have different usage at different places.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 06:56:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301499#M502993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T06:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Simple SELECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301500#M502994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will have to loop through the internal table int_people.&lt;/P&gt;&lt;P&gt;If you are familiar with Java then int_people is kind of a cursor, it is called internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT INT_PEOPLE.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; int_people-name.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will display all the names fetched by the query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 06:58:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-select/m-p/2301500#M502994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T06:58:55Z</dc:date>
    </item>
  </channel>
</rss>

