‎2009 Aug 20 3:24 PM
I have a ztable with 15 fields and i declared the itab and work area same as ztable.
Now i want to fetch only 5 fields which are not in sequence into itab.As the structure is same can i use into table rather than corresponding fields? Is any problem in this.
select fiel2 field5 field6 field7 field9 from ztable into table itab where field = p_field.
‎2009 Aug 20 3:28 PM
Hi,
No you can not.
But i am strage that you are asking these type of questiones. Because if you read any basic ABAP Book there it self you can find all the answers of these type of questions.
Regards,
Raj Gupta
Edited by: RajGupta on Aug 20, 2009 4:31 PM
‎2009 Aug 20 3:29 PM
Yes, there is a problem with this. however, it's easily fixable.
As you are already reserving the memory space for the full table in your itab and workarea (it's declared as the ztable) then you could just select * into it and the only use the five fieds you need in your program. This will be faster than using into corresponding fields of.
‎2009 Aug 20 3:30 PM
‎2009 Aug 20 3:30 PM
Hi,
The easiest way to answer this question will be for you to try it, it will be pretty obvious if it works or not.
However, my feeling is it will not work, it will put all of the fields at the beginning of itab.
Regards,
Nick
‎2009 Aug 20 3:30 PM
Hi,
Arrange your itab in the order of your ztable fields and then use select ....into table
else you need to use move-correspong
Regards,
Satish
‎2009 Aug 20 3:36 PM
Hi ,
You can use the select staement .You can also use select.. corresponding Fields also
else you can also use
SELECT s1 ... sn FROM dbtab dbtab APPENDING CORRESPONDING FIELDS OF TABLE itab
from performance point of view create internal table with rows that you need to manipulate
because select..corresponding takes a time and is not suggested.
Thanks and Regards
Aditi Wason
‎2009 Aug 20 4:06 PM
Hi,
Do you really need a sturcture which is defined in the data dictionary?
An complete different aproach would be to build a dynamical itab.
What I mean? You declare the structure of your internal table within the coding of your program.
One way to do this would be with a statment like this (just to give a hint):
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fcat
IMPORTING
ep_table = ref_t_data.
This would allow you to do anything you like, because you even can built a select statement on runtime.
So far I didn't observe any "new" performance problem when doing so.
Kind regards
Herbert
‎2009 Aug 20 5:27 PM
thank you experts.
I tried and I got dump .
I thought some new way of doing will be there for this rather than using into corresponding fields.
Thank you once again for the responses