Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select statements

Former Member
0 Likes
785

Hi exports,

Can any body tell me difference between

select * from db ti itab

select single * from db to itab

select * from db for all entries its

select * from db for corresponding values itab

I read in the document but I am not clear.

please suggest me if any good notes is there.

Thanks

Nithin

8 REPLIES 8
Read only

Former Member
0 Likes
755

Basically all the below are some variations of SELECT statement to fetch data from database tables.

<b>select * from db ti itab</b>

It is the stand way to fetch the data from database table append the same into internal table itab.(Please check the syntax the above is incorrect). U need to make sure that itab has the same field sequence as you are fetching in the SELECT statement.

<b>select single * from db to itab</b>

Here is fetches a single record from database as to the specified key.

<b>select * from db for all entries its</b>

The particular variation is used when you required to fetch data from a table, for all entries in another internal table. It can said to be equivalent to

Loop at itab.

SELECT * from db into jtab

where xyz = itab-xyz.

endloop.

<b>select * from db for corresponding values itab</b>

It is similar to the first statement the difference is that it would update the corresponding fields in table itab so the sequence of fields in itab and SELECt can be different

Message was edited by: Anurag Bankley

Read only

Former Member
0 Likes
755

Hi nithin,

1.

select * from db ti itab

It should be

select * from db INTO TABLE itab

-- A Normal select statement,

which puts <b>all the records</b> fetched

in itab.

2.

select single * from db to itab

<b>ONLY 1 record</b>

3. select * from db for all entries its

This is used for further filteration

w.r.t some values

in another internal table (and not dbtable where clause)

4. select * from db for corresponding values itab

Fetches all records,

and puts in itab,

ONLY THOSE FIELDS whose NAME Matches,

only those are put, rest are ignored.

regards,

amit m.

Read only

Former Member
0 Likes
755

hi Nithin,

select * from db ti itab

<b>selects all the records from the db</b>

select single * from db to itab

<b>select only one record from the db</b>

select * from db for all entries its

<b>select all the entries in its from db</b>

select * from db for corresponding values itab

<b>select all the entries from itab without bothering the order in which the fields are there</b>

Regards,

Santosh

Read only

Former Member
0 Likes
755

select * from db ti itab

Retrives all the records and all fields from the database table to itsb

select single * from db to itab

select the single record and all fields based on the where condition

select * from db for all entries its

for every unique entry in the internal table that you will mention in for all entries statement , it will retrive all the records and all the fields from database table

select * from db for corresponding values itab

if the fieldnames of database table and internal table are same , then u can use corresponding

Read only

Former Member
0 Likes
755

HI Nithin,

1. Select * from DB into table Itab.

select all records from DB and appends in itab.

2. Select Single * from DB into itab.

Select the first record from DB which matches the condition ( If any) into itab.

3. Select * from DB for all entries in its into itab.

Select records from DB those are in its according to condition and appends it to itab.

4. Select * from DB for corresponding values itab.

Select records from DB and appends the itab where the same fields in DB and itab there. the remaining fields left blank

regards

Read only

Former Member
0 Likes
755

hi nitin,

1. <b>select * from db ti itab</b>

this reads all the relevant rows from DB that satisfy the WHERE clause.

2. <b>select single * from db to itab</b> this expects a primary key in WHERE clause and gets a single record. if primary keynot given like this, it fetches the first occurence.

3. <b>select * from db for all entries</b> this is used for selecting the relevant rows for all the entries in the internal table <itab>.

4. <b>select * from db for corresponding values itab</b> same as (1) but here u r retrieving few selected fields bcoz itab doesn't have all the components as the DB table

reward if useful...

Read only

Former Member
0 Likes
755

Hi,

1)select * from db ti itab

<b>select all records from database table.</b> select

2)single * from db to itab

<b>select first row matching where condition</b>

3)select * from db for all entries its

selets data with the entries corresponding to internal table

4)select * from db for corresponding values itab

itab has two fields matnr,werks so only

this two fields are populated in internal table

irrespective of mara having 30 fields.

Regards

Amole

Read only

Former Member
0 Likes
755

hi,

select * from selects

all the records from the mentioned table.

select single * from selects

selects single record from the table mentioned

select * from db for all entries its

select all records based on the entries selected from the previous table.

select * from db for corresponding values itab.

selects the data and pushes the data into the internal table irrespective of the order defined.