08-21-2007 12:44 PM
hi all,
Performance wise which is correct one.
1. select * from vbrk into ivbrk where vbeln in s_vbeln
select kunnr name1 regio from kna1 for all entries in ivbrk where kunnr = ivbrk-kunag.
loop at ivbrk.
read table ikna1 with keykunnr = ivbrk-kunag.
if sy-subrc = 0.
ivbrk-regio = ikna1-regio.
endif.
modify ivbrk transporting regio.
endloop.
2. select * from vbrk into ivbrk where vbeln in s_vbeln
loop at ivbrk.
select single regio name1 from kna1 into (v_regio,v_name1) where kunnr = ivbrk-kunag.
ivbrk-regio = v_regio.
modify ivbrk transporting regio.
endloop.
in first one im selcting datas in ikna1 by select statement and within loop endloop am reading the internal table ikna1.
in second one within loop and endloop and using select single to to fetch data from kna1.
here everytime am hitting database table using select single.
So can you please tell me which is correct for improving the performance tunning.
regards,
Ramya
08-21-2007 12:50 PM
Hi
use first one and modify like this
select * from vbrk into TABLE ivbrk where vbeln in s_vbeln.
SORT IVBRK.
DELETE ADJACENT DUPLICATES FROM IVBRK COMPARING KUNNR.
IF IVBRK[] IS NOT INITIAL.
select kunnr name1 regio from kna1INTO TABLE IKNA1 for all entries in ivbrk where kunnr = ivbrk-kunag.
ENDIF.
loop at ivbrk.
read table ikna1 with key kunnr = ivbrk-kunag.
if sy-subrc = 0.
ivbrk-regio = ikna1-regio.
endif.
modify ivbrk transporting regio.
CLEAR IVBRK,IKNA1.
endloop.
reward points to all helpful answers
kiran.M
08-21-2007 12:46 PM
08-21-2007 12:47 PM
first one is correct. it will definitely improve perfomance.
Sameer
08-21-2007 12:50 PM
Hi
use first one and modify like this
select * from vbrk into TABLE ivbrk where vbeln in s_vbeln.
SORT IVBRK.
DELETE ADJACENT DUPLICATES FROM IVBRK COMPARING KUNNR.
IF IVBRK[] IS NOT INITIAL.
select kunnr name1 regio from kna1INTO TABLE IKNA1 for all entries in ivbrk where kunnr = ivbrk-kunag.
ENDIF.
loop at ivbrk.
read table ikna1 with key kunnr = ivbrk-kunag.
if sy-subrc = 0.
ivbrk-regio = ikna1-regio.
endif.
modify ivbrk transporting regio.
CLEAR IVBRK,IKNA1.
endloop.
reward points to all helpful answers
kiran.M
08-21-2007 12:56 PM