‎2008 Jun 24 7:53 AM
Hi everyone
i have a report and in that one i have displayed hot pack data i.e. Component,Soft.Component,Level,Support pack,supp.pack type.
i have retrieved this data from the table cvers and cvers_ref.
now i got the output but my requirement is changed now.
i dont want multiple records having same support type.
only one record is required for every support type.
can any suggest me like what condition i have to put in the select statement to avoid duplicate support types please...
its very urgent
‎2008 Jun 24 7:56 AM
hi,
check this sample code.
do the same for ur program by comparing support type.
SELECT pernr begda werks btrtl orgeh persk plans kostl aedtm
FROM pa0001 INTO CORRESPONDING FIELDS OF
TABLE it_pa0001 FOR ALL ENTRIES IN it_pa0000
WHERE pernr = it_pa0000-pernr AND
aedtm > date1.
SORT it_pa0001 BY pernr aedtm.
DELETE ADJACENT DUPLICATES FROM it_pa0001 COMPARING pernr.
‎2008 Jun 24 7:56 AM
Hello,
You'll have to check your join condition to avoid the duplicate records.
Or once you've ur internal table use DELETE ADJACENT DUPLICATES by comparing the key.
Reward, if useful.
Rgds,
Raghu.
‎2008 Jun 24 7:56 AM
It could be done by using
SELECT DISTINCT <supporttypes>
from <table>
into...
where...
groupby <supporttypes>.
Or once the entire data is fetched into internal table. you may sort it by support type and then delete adjacent duplicates comparing support type.
Reward if useful.
‎2008 Jun 24 7:56 AM
Hi,
Try this...
DELETE ADJACENT DUPLICATES FROM itab COMPARING SUPPORTTYPE(FIELDNAME)
Cheers,
Sai
Edited by: Saikumar on Jun 24, 2008 8:56 AM
‎2008 Jun 24 7:57 AM
Ravi,
i would suggest as you said you are getting right output but the thing is that you are getting duplicate records.
for getting rid of it dont temper you select statement because if you so so than you might be have to do some more changes in your program.
the simplest solution is that try to use delete adjecent duplicate from itab comapring <support type> at last just before reuse alv fm is called.
Amit.
‎2008 Jun 24 7:59 AM
‎2008 Jun 24 8:01 AM
Hi,
sort the final internal table by the support type.
And then use the delete adjacent duplicates for that internal table.
for eg. sort itab by matnr.
delete adjacent duplicates from itab comparing matnr.
hope this may help you.
thanks
‎2008 Jun 24 8:09 AM
i have done the following change but still the same output. please look in to the code and let me know where i have to change
select pcomponent pEXTRELEASE prelease fPATCH f~patch_type
into corresponding fields of table fintab from cvers as p inner join pat03 as f
on pcomponent = faddon_id.
select kdesc_text kcomponent into corresponding fields of table fint from cvers_ref as k inner join cvers as l
on kcomponent = lcomponent where k~LANGU = 'EN'.
sort fintab BY component.
DELETE ADJACENT DUPLICATES FROM fintab COMPARING component.
loop at fintab into wa_ftab.
loop at fint into wa_fint.
write 😕 wa_ftab-component under 'Component', wa_ftab-release under 'SoftComp',wa_ftab-EXTRELEASE under 'Level',
wa_ftab-patch under 'SuppPackType',wa_ftab-patch_type under 'Descrp',
wa_fint-DESC_TEXT under 'SupportPack'.
skip.
endloop.
endloop.
‎2008 Jun 24 8:13 AM
Hi Ravi,
Its Better you use DISTINCT keyword in select statement.. before the field which you need.
Hope this would be helpful
Regards
Narin Nandivada
‎2008 Jun 24 8:20 AM
hi
can anyone modify the select stamt using distinct. i tried but no result.
‎2008 Jun 24 8:25 AM
Hi Ravi,
you will get your problem solved by using SELECT DISTINCT ... in the Select query.
Reward if find helpful.
all the best.
Anirban Bhattacharjee
‎2008 Jun 24 8:34 AM
HI,
Try to use SELECT [DISTINCT] <cols> ... WHERE
in your select query.using this the the system excludes duplicate entries.
Hope it would be useful
Regards,
Bhumika