2010 Mar 19 9:45 AM
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
2010 Mar 22 10:45 AM
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
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
2010 Mar 19 12:22 PM
if it is one time selection for bukrs,augbl,auggj,kostl,prctr,gsber,aufn (mean you need to select the value from itab for only one combination of these fields) than you can simply fetch record in another itab and and at the same time do a count.
now based on the count value append the values in the required itab.
2010 Mar 22 10:45 AM
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
2010 Mar 23 4:24 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |