Application Development 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: 

Question reg. select statement

Former Member
0 Kudos

If I mention the fields to be selected in the select statement, do I still need to mention 'Into corresponding fields of'?

select fieldA fieldB fieldC

from dbtable

into table itab

---

---

OR

select fieldA fieldB fieldC

from dbtable

into corresponding fields of table itab

---

---

Thanks,

Krishen

1 ACCEPTED SOLUTION

anversha_s
Active Contributor
0 Kudos

hi krishen,

one abap tip.

try to avoid into corressponding.it will reduce performance.

declare ur internal table in correct format.

select fields in the same order of the internal table fields.

use INTO TABLE.

RGDS

anver

pls mark hlpful anwsers

15 REPLIES 15

Former Member
0 Kudos

yes - when order of your fiels in your select statment is different from order of the field in you it_tablee.

BR, JAcek

Message was edited by: Jacek Slowikowski

Former Member
0 Kudos

Hi,

it depends on the declaration of internal table. If the field sequence in internal table is in sequence with select then no need of into corresponding fields addition else it is required.

Hope this helps.

0 Kudos

Thank you friends.

does 'into corresponding fields of' decrease performance in any way?

Thanks,

Krishen

0 Kudos

yes . performance of into corresonding field is worse then into table statment.

0 Kudos

Hi,

Yes performance wise it is not recommended.

Thanks.

Former Member
0 Kudos

hi,

Yes, you have to mention it.

though you mention fields in select statement, you have to specify <b>into corresponding fields of table it_table</b>.

If the fields are specified in the same sequence as in internal table, we can just say <b> into table it_table</b>.

REgards,

Sailaja.

anversha_s
Active Contributor
0 Kudos

hi krishen,

one abap tip.

try to avoid into corressponding.it will reduce performance.

declare ur internal table in correct format.

select fields in the same order of the internal table fields.

use INTO TABLE.

RGDS

anver

pls mark hlpful anwsers

Former Member
0 Kudos

For example if u have a internal tabel like this:

data: begin of i_data occurs 0,

data1 type char10,

data2 type char10,

data3 type char10,

end of i_data.

Select data1 data2 into table i_data from <table>.

Here into corresponding fields is not necessary.

But,

Select data2 data3 into corresponding fields of table i_data from <table>.

Here it is neccessary.

It all depends on ur internal table declaration.

Prakash.

Former Member
0 Kudos

Hi

It depends on the declaration of your internal table. If you have declared the data in the internal table in the same order of the select statement that is like this

data: begin of itab occurs 0,

a type i,

b type i,

c type i,

d type i,

end of itab.

then no need of into corresponding fields of.

If the data is not in the order which you mentioned in the internal table then you have to use into corresponding fields of.

Hope this will help you.

Regards

Haritha

former_member404244
Active Contributor
0 Kudos

hI,

Declare like this.

types: begin of ty_strt,

fielda like db-fieldname,

fieldb like db-fieldname,

fieldc like db-fieldname,

end of ty_strt.

data : ta_strt type table of ty_strt.

now write select query

select

field1

fieldb

fieldc

from db

into table ta_strt.

regards,

nagaraj

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If the field list in the internal table is exactly the same as the fields in your internal table(data type and length), then there is no need to use "INTO CORRESPONDING", but you still need to say INTO TABLE OF.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi krishen,

1. Both will work.

2. to get a taste of it, just copy paste

3.

report abc.

*----


DATA : BEGIN OF ITAB OCCURS 0,

BUKRS LIKE T001-BUKRS,

BUTXT LIKE T001-BUTXT,

END OF ITAB.

*----


SELECT BUKRS BUTXT

INTO TABLE ITAB

FROM T001.

SELECT BUKRS BUTXT

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM T001.

BREAK-POINT.

regards,

amit m.

Former Member
0 Kudos

Hi,

If the order of the fields selected in the select statement and the order of fields in the table are same then it is not necessary to use into corresponding fields. And it is not recommended to use INTO CORRESPONDING addition in veiw of performance.

Thanks and Regards,

Bharat Kumar Reddy.V

Former Member
0 Kudos

hi,

Yes, it does.

It has to first find the corresponding field and then send data to it. In case of into table, it just sends data.

So, into corresponding fields take make time.

Regards,

Sailaja.

anversha_s
Active Contributor
0 Kudos

hi krishen

if ur issue solved, kindly close the thread after giving suitable points.

rgds

anver