How to code this - Please advise

Dear friends,
     Please advise as how to code the below scenario in order to obtain the best performance.
I've an internal table IT_BSAD.Now I've to check if in the combination of bukrs,augbl,auggj,kostl,prctr,gsber,aufnr, if there is a single record in IT_BSAD, then it should be appended to IT_BSAD1 & if there are multiple records, then those should be appended to IT_BSAD2. In any case IT_BSAD1 & IT_BSAD2 should not contain duplicate records & records in IT_BSAD = records in IT_BSAD1 + Records in IT_BSAD2. I coded it somehow but it hangs in case of million of records. Please advise me the best way of doing it.
I'll appreciate any help in this regard.
Thanks:
Gaurav

prepare a sorted table with key bukrs,augbl,auggj,kostl,prctr,gsber,aufnr
loop it_basd assigning <fs_basd> .
at new sufnr.
lv_index = 0.
endat.
" move the fields to it_basd1 work area
"append it_basd1
lv_index = lv_index + 1.
if lv_index > 1.
if lv_index = 2.
read it_basd1 into iwa_basd2 with key  bukrs,augbl,auggj,kostl,prctr,gsber,aufnr.
append iwa_bsad2 into it_bsad2.
delete from  it_basd1 where  bukrs,augbl,auggj,kostl,prctr,gsber,aufnr.
endif.
" move the fields of <fs_basd> to it_basd2 work area
append iwa_bsad2 into it_bsad2.
endif.
endloop.
hope this will help
Nafran

Similar Messages

Maybe you are looking for

  • Possible memory leak in Weblogic 7.0

    We have developed an EJB application on Weblogic 7.0 running on HP-UX 11.0. Some JSP/Javabean programs, that lookup EJB compoments for services, are developed on the Resin web server to serve browser requests. Both Resin and Weblogic are running on t

  • Which format to burn in?

    Okay, I have a smallish HD (10gb) and I want to burn some songs from my CDs. Which format should I be burning my songs into? I've tried burning them in both mp3 and AAC format and I DON'T see much of a difference, size wise.

  • Firefox refuses to update past v2 despite numerous attempts

    Hi! After seeing repeated nag msgs from youtube etc informing me I was using an out of date browser, I downloaded v 3.6 from mozilla website. I ran the program... it did 'a little housekeeping' and updated my FF, or so I thought... fast forward a cou

  • How do you track hits on hit counter in iWeb?

    I have been creating a personal poetry website on iWeb and I am fairly new to Mac in general.  I found the Hit Counter button and added it to every page on my website.  My question is how do I see how many hits i have?  The hit counter does not show

  • LIV - credit memo : error message shown for unit price variances

    hi In LIV for Credit Memo, there is no warning nor error message shown for unit price variances (price different from that in PO).  Request not allow to have unit price variances for Credit Memo. pls advice how can i do it thanks