cancel
Showing results for 
Search instead for 
Did you mean: 

delete adjacent duplicates how to use in the below select statement

Former Member
0 Kudos
636

hi i have a problem

i am suing the below select statement

SELECT a~extno

a~guid_lclic " for next select

e~ctsim

e~ctsex

*revised spec 3rd

f~guid_pobj

f~amnt_flt

f~amcur

f~guid_mobj

e~srvll "pk

e~ctsty "PK

e~lgreg "PK

INTO TABLE gt_sagmeld

FROM /SAPSLL/LCLIC as a

INNER JOIN /sapsll/tlegsv as e on elgreg = algreg

inner join /sapsll/legcon as f on fguid_lclic = aguid_lclic " for ccngn1 selection

inner join /sapsll/corcts as g on gguid_pobj = fguid_pobj

where a~extno in s_extno.

sort gt_sagmeld by guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ.

delete adjacent duplicates from gt_sagmeld comparing guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ .

now i am confused how to use delete adjacent dupliacate and on which fields

as first table /sal../lclic primary key is guid_lclic

and it is joined to table

legcon by guid_lclci ( not a primary key here)

legcon primary key is guid_legcon

and table 3 legsv by lgreg (pk here)

table 3 has tow more primary key srvll and ctsty also

NOW MY QUESTIO IS TAHT IS I USE ABOVE DELETE ADJACENT STATMENT IT FETCHES 20 LAKH RECORDS

I WANT TO REDUCE IS LET ME KNOW ON WHAT fields i need to use delete adjacen duplicates

or use comparing all fields?

regards

Arora

Accepted Solutions (0)

Answers (2)

Answers (2)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

If you try using for all entries instead of joins and then sorting the table by primary key and then do the deletion based on primary key will be better for the next tables.

Former Member
0 Kudos

hi,

delete by comparing key fileds only(primary key fields).

Instead of using joins use for all entries .

check for sy-subrc =0.

then sort the internal table .

delete adjacent duplicates comparing key filed.

endif.

this will increase ur performnace

Former Member
0 Kudos

hi sudha

if u see my select statement is contains four Primary keys

srvll

lgreg

ctsty

guid_lclic

but the next table connected to this table legcon is by guid_pobj and anothe table by guid_mobj

and if i take this gt_sagmeld to another temp table and i find abt 10 lakh uniques guid_pobj

similary 6 lakh guid_mobj so the next slect is hanpering because of this

not COMING TO OUR POINT IF I SORT ONLY BY OUR PRIMARY KEYS NOT TAKING INTO ACCOUNT TEH GUID_POBJ AND GUID_MOBJ

THE ENTRIES ARE VERY LESS BUT IF I TAKE INOT ACCCOUNT IN GT_SAGMELD THE ENTRIES ARE ABT 20 LAKH

SO I AM NOT SURE WHETHER TO TAKNE GUID_POBJ AND GUID_MOBJ INOT ACCOUNT FOR DELECTING ADJACENT DUPLICATES?

HENCE THE QUESTION OF ON WHICH FIRLD DELETE OR COMPARING ALL FIELDS I USE?