‎2008 Oct 30 8:27 AM
dear all,
i want to select a record,but i don't know how to do it, can you help me ?
for example
budat matnr
20081027 1
20081027 2
20081028 2
20081029 3
20081029 2
what i want to select is that,the element budat,the day 20081028 there is only one record.
if there are several records with the same budat,there records are not what i want.
could you tell me how to write this kind of select statement.
‎2008 Oct 30 8:34 AM
use select count <fld> .............
and check if count = 1 then append it into another internal table.
‎2008 Oct 30 8:29 AM
Hi,
Make use of DISTINCT key word in the select statement.
Thanks,
Sriram Ponna.
‎2008 Oct 30 8:32 AM
Hi,
SELECT SINGLE * FROM <table> WHERE budat = p_budat
AND matnr = p_matnr.
Regards
Bala Krishna
‎2008 Oct 30 8:32 AM
Hi,
First u can get all the entries in an internal table and use DELETE ADJACENT DUPLICATES FROM ITAB COMPARING BUDAT statement to delete the multiple records.
‎2008 Oct 30 8:39 AM
HI,
Please ignore my previous reply. Delete adjacent duplicates wil not fulfill ur requirement. It will have the other entries also.
‎2008 Oct 30 8:32 AM
Hello,
First get all the records then loop the internal table and check the budat and filter the according to u r requirements.
or Use the delete adjucent dublicate records comparing budat matnr
Edited by: Santosh Marupally on Oct 30, 2008 9:33 AM
‎2008 Oct 30 8:33 AM
Hi,
To select a single record with a given selection criteria use the following .
tables: mara.
select single * into mara
where matnr = '123456'.
write: / mara-matnr.To select multiple records use the following
tables: mara.
data: gt_mara type table of mara.
select * into table gt_mara
from mara
where mtart = 'ABC'.
loop at gt_mara into mara.
write: / mara-matnr.
endloop.Darren
‎2008 Oct 30 8:34 AM
use select count <fld> .............
and check if count = 1 then append it into another internal table.
‎2008 Oct 30 8:46 AM
hi all, i am sorry that i have not explained my question clearly.
before i use select, i dont know the data in the table.
what i want to get is the date which is only one record in the table.
and i think i should use key word count,but i dont know how to use it.
and there is not condition in my select statement,the only conditon is which date there is only one record in the table.
‎2008 Oct 30 8:50 AM
‎2008 Oct 30 9:04 AM
Hi,
tables: mara.
data:lt_mara like mara occurs o with header line.
select * from mara into lt_mara
where budat = pa_budat.
loop at lt_mara.
write: / lt_mara-matnr,lt_mara-budat.
endloop.
‎2008 Oct 30 9:56 AM