01-29-2008 5:25 AM
hi all,
i declared internal table like this:
data: itab like dbtab occurs 0 with header line.
i want to fetch the data from the dbtab. and i written
select * from dbtab into corresponding fields of table itab.
write: itab-fileds.
but in this way i am not getting records
this one i did differenrtly:
select * from dbtab into corresponding fields of itab.
write: itab-fileds.
endselect.
in this way i am fetching all the records
what is the problem in first select ststement.
01-29-2008 5:30 AM
prS.
In your first statement
you are not looping the select statement.So internal table unable to print all records.
But in you select statement you are looping the select statement by SELECT ......ENDSELECT.
That is the reason second statement is giving output.
One more suggestion
when you have declared internal table with same structure like your dbase table why do you use into coreesponding in select statement .It give bad performance.
Don't forget to reward if useful....
01-29-2008 5:30 AM
Hi
Instead of select * from give the select (field names).
Mention the field names, hope it will work.
Reward if help.
01-29-2008 5:30 AM
Hi,
after selecting the data u write write: itab-fileds.in loop endloop.
Regards
01-29-2008 5:30 AM
prS.
In your first statement
you are not looping the select statement.So internal table unable to print all records.
But in you select statement you are looping the select statement by SELECT ......ENDSELECT.
That is the reason second statement is giving output.
One more suggestion
when you have declared internal table with same structure like your dbase table why do you use into coreesponding in select statement .It give bad performance.
Don't forget to reward if useful....
01-29-2008 5:31 AM
In debug mode you verify your internal table contents.
then try to use this:
loop at itab.
write:/ itab-fields.
endloop.
01-29-2008 5:31 AM
you know actually ur itab is populated in both cases.
problem is in your write statement.
in first case there is no loop .
so try this syntax with first case----
*select * from dbtab into corresponding fields of table itab.*
loop at itab.
write: itab-fields.
endloop.
it will work definitely
plz reward if useful
keep rockin
vivek
01-29-2008 5:34 AM
Hi,
Declare internal table like this.
types: begin of ty_mara,
matnr type mara-matnr,
matkl type matkl-matkl,
end of ty_mara.
data: it_mara type table of ty_mara, "internal table
wa_mara type ty_mara. " work-area.
select matnr matkl from mara
into table it_mara.
then loop the table it_mara for displaying the records.
loop at it_mara into wa_mara.
write: / wa_mara-matnr, wa_mara-matkl.
endloop.
don't use select endselect statment. it will cause performance issue.
regards,
Santosh Thorat
.
01-29-2008 5:36 AM
select *
from dbtable
into table itab.
loop at itab.
write:/ itab-field1,itab-field2....
endloop.
01-29-2008 5:38 AM
Hi,
In the first statement instead of using * use all the field names to be selected.
In the case of using * there must be end statement for that select. it perfomence is just like loop and endloop.
so that u can write the itab now.
regards,
vasavi.
01-29-2008 5:51 AM
select * from dbtab into corresponding fields of table itab.
case 1
whenever you use of table in a select statement in a select statement , it automatically loops for all record in dbtab in single line into itab.
case 2
but whenever you avoid of table you have to add a endselect statement , and now you can loop between these two codes any no of statement you want with count equal to number of records in dbtab.
DIFFERENCE
when you dont have any codes to loop that is you only have to populate the itab from dbtab always use case1 as performance wiser in case2 ENDSELECT statement has to be executed every time for each record transported from dbtab to itab
this increases load on presentation server and database server.
eg suppose for 1000 lines 1000 times endselect statement will be executed.