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: 

Avoid "INTO CORRESPONDING FIELDS OF TABLE"

Former Member
621

Hi All,

I am selecting the fields from Table: ADRC and populating it to internal table but internal table has extra fields STR_ERG2, ANZPERS, VBSART and STR_ERG4.

I can't change internal table because it the EXPORTING parameter of the method and method is used lot of places. can any one help me making "INTO CORRESPONDING FIELDS OF TABLE" to "INTO TABLE" and adding fields to select ( STR_ERG2, ANZPERS, VBSART and STR_ERG4) which are not in the ADRC table.

SELECT city1

city2

post_code1

post_code3

street

house_num1

house_num2

str_suppl1

str_suppl2

location

floor

roomnumber

country

region

addrnumber

sort1

sort2

INTO CORRESPONDING FIELDS OF TABLE itab

FROM adrc

WHERE sort1 EQ p_sort1

AND addr_group EQ 'PM01'.

Thanks

Krishna

Edited by: Krish7 on Aug 12, 2011 3:48 PM

Edited by: Krish7 on Aug 12, 2011 3:50 PM

5 REPLIES 5

Former Member
0 Kudos
121

Hi

your code seems to be right, where's the problem?

Max

Edited by: max bianchi on Aug 12, 2011 4:08 PM

0 Kudos
121

I want to take out INTO CORRESPONDING FIELDS OF TABLE and use INTO TABLE but in have Extra fields which i have to put it in select fields STR_ERG2, ANZPERS, VBSART and STR_ERG4. which are not part of ADRC table...

Hope you got it, it can be done by making this fileds (STR_ERG2, ANZPERS, VBSART and STR_ERG4) initial but i don't know how to do it. Please help me...Thanks!!!

0 Kudos
121

Hi

I don't know if it's possible because the statament INTO TABLE fills the target structure field by field: that means the target structure has to have the same definition of the source one:

no matter the name of the field, but as they are ordered in the structure.

So if the first fields of the target structure are the same fields of the selection you can use INTO TABLE, else you need to use a new internal table having the same fields of selection of ADRC, but then you need to loop this new table in order to trnasfer the data to importing parameter.

That means you csn use INTO TABLE only if the extra fields are at the end of the internal table, ie.the first fields are ones of ADRC

Max

Edited by: max bianchi on Aug 12, 2011 4:24 PM

Edited by: max bianchi on Aug 12, 2011 4:28 PM

0 Kudos
121

Hi Max,

1) The Target table has fields (STR_ERG2, ANZPERS, VBSART and STR_ERG4) but ADRC does not has this fileds.

2) i wan't to use INTO TABLE

3) I don't want to use loop it later Because ADRC is MASTER TABLE and it's performance issue

Regards

Krishna

ThomasZloch
Active Contributor
121

Please read

and understand why it does not make sense to not use INTO CORRESPONDING when you actually need it for your processing.

Thread locked, because this has been discussed many times.

Thomas