‎2010 Jan 04 1:19 PM
Dear Friends,
I am working On report,
In that i have to delete only duplicate records , ( Delete adjestent duplicate comapring field will delete the entire row)
I dont want to delete entire row just want to show duplicate records empty on the next row.
For EXample
DOc.NO Customr Advnce scheme
1234 11111 1000 400
1234 1111 1000 200
Above doc number customer and advnce fields are having same values and scheme is having differnt value
in that i just want to delete duplicate records in second row i.e. ( 1234 1111 1000)
Is there any way,
Please help me out.
Regards
Rohan
‎2010 Jan 05 12:19 PM
Hi
A Question: Is it that a document will always have one advance? If Yes, then:
1.Loop on your table. At NEW Docno, clear a flag.
2. Set the flag only if you get an advance,
3. For all the following records, you can check the falg and process.
Regards
Raj
‎2010 Jan 04 1:33 PM
Hi,
I think it is not duplicate records because the scheme value is different.
Better short the output by DOc.NO Customer Advnce.
or post forum bit clearly.
Arun.
‎2010 Jan 04 1:38 PM
Hi Arun
Few records are duplicate and
For same Document and customer 2 schems are there and advance given is only once..
but it is showing that advance 2 times after sorting .
So my calculations are going wrong.
ok is there any method to delete only perticular records not entire row.
‎2010 Jan 04 1:54 PM
Hi Katyare,
I assume you are using the internal table for calculating a total of advances for a particular document. If a document has multiple schema - then the same advance comes multiple times and hence creates havoc with your summation.
Solution needed is to retain the records in internal table, but for every duplicate document number occurence clear out the advance amount.
Instead of using delete adjacent duplicates - try using control break statements within the loop/ endloop scope. What you can do is clear out the advance amount for all records except AT NEW docnr.
Hope this helps.
Regards,
Adi
‎2010 Jan 04 2:11 PM
Hi Aditya,
Thanks For the reply
i am using t_final and wa_final.
u mean
Loop at itab
Atend of t_final-kwert.
Clear t_final.
endat.
endloop.
is it that
‎2010 Jan 04 5:05 PM
not yet, because it will not elimitate triple records. Easiest solution is after sorting, loop and insert into a sorted table with unique key. If success (sy-subrc = 0), ist is no duplicate, otherwise it is and should not be consiedered for calculation.
Regards,
Clemens
‎2010 Jan 04 8:28 PM
Is this the final internal table ? if you are displaying in alv use sort and group .. if its a classic report use control break statements and format your output .. deleting the specific fields doesnt make any sense ..
‎2010 Jan 05 9:17 AM
‎2010 Jan 05 9:21 AM
Hi,
can you please post your relevant code as formatted code and tell us where what does not work.
I think I can help you. As an abstract guiding obviously does not help you, I need at least the code that does not work.
Thank you.
Regards,
Clemens
‎2010 Jan 05 8:12 PM
Hi You can go through the code
READ TABLE T_KONV INTO WA_KONV WITH KEY KNUMV = WA_VBRK-KNUMV
KPOSN = WA_VBRP-POSNR
KSCHL = 'ZOT1' .
IF SY-SUBRC = 0.
WA_FINAL-KWERT = WA_KONV-KWERT.
ENDIF.
CLEAR WA_T001W.
READ TABLE T_T001W into wa_t001w WITH KEY WERKS = WA_VBRP-WERKS.
IF SY-SUBRC = 0.
WA_FINAL-NAME1 = WA_T001W-NAME1.
ENDIF.
CLEAR wa_t005u.
READ TABLE t_t005u into wa_t005u with key bland = wa_vbrp-wkreg.
if sy-subrc = 0.
wa_final-BEZei = WA_T005U-BEZEI.
endif.
clear wa_kna1.
READ TABLE t_kna1 into wa_kna1 with key kunnr = wa_vbrk-kunrg.
IF SY-SUBRC = 0.
wa_final-Name2 = wa_kna1-name1.
endif.
wa_final-kwert = wa_final-kwert * ( -1 ).
IF wa_final-FKLMG <> 0.
if sy-subrc = 0.
wa_final-ADVNCE = WA_FINAL-KWERT / wa_final-FKLMG.
wa_final-RATE = wa_final-ZRB_ACAMT / wa_final-FKLMG.
endif.
endif.
.
WA_FINAL-DIFFRENCE = WA_FINAL-KWERT - WA_FINAL-ZRB_ACAMT.
IF wa_final-VBTYP = '0'.
if sy-subrc = 0.
wa_final-fklmg = wa_final-fklmg * ( -1 ).
wa_final-kwert = wa_final-kwert * ( -1 ).
endif.
endif.
APPEND WA_FINAL TO T_FINAL.
sort t_final by KWERT.
CLEAR WA_FINAL.
endloop.
See KWERT is the Advance Given
For Same Document number Advance given will be only once but schemes are two,
I dont want to consider Advance given evry time for each scheme for same document number.
It gives problem while calculating differnce in Advance given and acrrual amount.
I hope u undstand my problem
‎2010 Jan 05 12:19 PM
Hi
A Question: Is it that a document will always have one advance? If Yes, then:
1.Loop on your table. At NEW Docno, clear a flag.
2. Set the flag only if you get an advance,
3. For all the following records, you can check the falg and process.
Regards
Raj
‎2010 Jan 05 1:45 PM
‎2010 Jan 07 4:01 PM
Thanks ,
I used At new and gave flag to same document number,
Problem solved..
regards
Rohan