12-05-2007 5:56 AM
hi mine is small critial doubt
what is the procedure to delete a record from internal table which is only once in that table .
i mean that i want duplicate records and i dont want a single existing record in an internal table pls help me for this
12-05-2007 6:05 AM
Hi,
Try the below logic, u can get the required output.
itab2[] = itab1[].
loop at itab1.
count = 0.
Loop at itab2 where itab2-keyfields = itab1-keyfields.
count = count + 1.
endloop.
if count = 1.
delete itab1.
endif.
endloop.
Result will be available in ITab1.
12-05-2007 5:58 AM
Hi,
First sort your internal table using key fields, then with the help of DELETE ADJACENT DUPLICATES from I_TAB comparing fields(key fields).
Cheers,
Bujji
12-05-2007 6:00 AM
bujji have u read my query ,
i need exact opposite for this k pls read my query once again
12-05-2007 6:02 AM
Hi,
Refer this code
*--Sort table by Personnel Number and Pay Scale Level
SORT it_final BY pernr endda begda.
LOOP AT it_final INTO wa_final.
lv_index = sy-tabix.
lv_index1 = lv_index - 1.
*--Clear
CLEAR : wa_final1.
READ TABLE it_final INTO wa_final1 INDEX lv_index1.
IF sy-subrc EQ 0 AND " check ur condition here
wa_final1-pernr EQ wa_final-pernr.
wa_final-incre = wa_final-bet01 - wa_final1-bet01.
else.
delete itab. delete if condition fails
ENDIF.
MODIFY it_final FROM wa_final INDEX lv_index
TRANSPORTING incre.
*--Clear
CLEAR : wa_final,
wa_final1.
ENDLOOP.
Regards,
PRashant
12-05-2007 6:05 AM
Hi,
Try the below logic, u can get the required output.
itab2[] = itab1[].
loop at itab1.
count = 0.
Loop at itab2 where itab2-keyfields = itab1-keyfields.
count = count + 1.
endloop.
if count = 1.
delete itab1.
endif.
endloop.
Result will be available in ITab1.
12-05-2007 6:08 AM
Hi Chaaya,
You can follow the following steps to get desired result.
assume u have internal table itab1
1) itab2[] = itab1[].
2) Delete all adjacent records from itab2.Now u will have the records which have single entry.
3) Now loop at itab2 and delete all the records present in itab1.
In this way u will get the desired result.
Reward if useful.
Regards,
Rajesh Akarte
Message was edited by:
Rajesh Akarte
12-05-2007 6:12 AM
read that record into header and write :
<b>delete itab.</b>
plz reward points if helps.
regards,
rahul