‎2008 Feb 04 6:45 AM
hi to all,
i want to fetch 5 records from standard table,
in that table ,for these 5 fields some records are repetetive.
if i fetch those recordds by using select query,only the first record is only coming,n remaining repetetive records are not coming.
i want to fetch all the reocrds.
ex: in std table 121 records are there,after fetching those data into internal table,only 68 records are coming.
plz suggest me,
regards
satya
‎2008 Feb 04 6:49 AM
Use the addition... [DISTINCT]
Effect
If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.
If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:
If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
If the system tries to access pool or cluster tables and single columns are specified in columns.
Notes
When specifying DISTINCT, note that this requires the execution of sort operations in the database system, and the SELECT statement therefore bypasses the SAP buffer.
‎2008 Feb 04 6:49 AM
based on ur select qurey it select the data from database.
selct <fieldlist>
from <dbtable>
into table <itab name>
where <condition>
Madhavi
‎2008 Feb 04 6:51 AM
Hi..
Use select DISTINCT
this will to the job for you
SELECT <OTHER FIELDS FROM BSIS> DISTINCT(ZOUNR) FROM BSIS
WHERE <CONDITION>.
BEST WAY TO DO SO....
SORT INT by ZUONR.
DELETE ADJACENT DUPLICATES from int COMPARING ZUONR.
REWARD if USEFUL
GAURAV J.
Edited by: GAURAV on Feb 4, 2008 7:53 AM
‎2008 Feb 04 6:55 AM
you should try this instead of your query
it will select all records from dbtab to your itab
select <field>
from <dbtab name>
into table <itab name>
where <condition>
this statement is really good performance wise
reward if useful
keep rockin
vivek
‎2008 Feb 04 7:03 AM
Hi,
What is ur Standard table ?
Use select * from tablename...
or
Select the unique key field in that standard table.
then it will select all the records, incase same record also.
Thanx
bgan.
‎2008 Feb 04 7:17 AM
Hi,
I think it is because you are not selecting the key fields in your selecton. To solve this problem make sure that you are selecting all the key fields( evenif these fields not requred for you also) or try to select all the fields ie, select *.
ie,
Select * from <DB> into correpondin fields of table <itab>.
or
Select <ALL key fields> < other required fields> from <DB> into correpondin fields of table <itab>.
Make sure that your ITAB is compatable to accomaodate all the fields including key fields.
‎2008 Feb 04 7:29 AM
hi to all,
i checked all of these suggestions,but i didnt get,
plz suggest me.
‎2008 Feb 04 7:36 AM
‎2008 Feb 04 7:38 AM
hai,
plz check this ,
in ur table find primary key field
then use
select <field>
from <dbtab name>
into table <itab name>
where <primary key field > in parameters [or]
select-options.