04-03-2008 4:29 AM
Hi,
In the below sql query does using
1.select endselect and the
2.function module to rounding off
will erode performance?
If so,how can we improvise it so that it won't mar the performance.
loop at itfinal where bwart = '601'.
*To get the Invoice Doc.No and the corresponding Tax Amount
select vbelv
posnv
from vbfa into (itfinal-vbelv,itfinal-posnv)
where vbeln = itfinal-mblnr and
posnn = itfinal-zeile and
vbtyp_v = 'J'.
endselect.
select vbeln
mwsbp
from vbrp into (itfinal-invno,itfinal-tax)
where vgbel = itfinal-vbelv and
vgpos = itfinal-posnv and
matnr = itfinal-matnr and
werks = itfinal-werks and
lgort = itfinal-lgort.
endselect.
*rounding off the Sale Tax Amount
if itfinal-tax <> '0.00'.
CALL FUNCTION 'J_1I6_ROUND_TO_NEAREST_AMT'
EXPORTING
i_amount = itfinal-tax
I_AMOUNT1 =
I_AMOUNT2 =
I_AMOUNT3 =
IMPORTING
E_AMOUNT = itfinal-tax
E_AMOUNT1 =
E_AMOUNT2 =
E_AMOUNT3 =
.
endif.
modify itfinal.
endloop.
Thanks
K.Kiran.
04-03-2008 4:46 AM
Hi,
please try this code...
select * into itab from vbfa
for all entries itfinal
where vbeln = itfinal-mblnr
AND posnn = itfinal-zeile
AND vbtyp_v = 'J'.
select * into itab from vbfa
for all entries itfinal
where vgbel = itfinal-vbelv
AND matnr = itfinal-matnr
and werks = itfinal-werks
and lgort = itfinal-lgort.
if its useful reward points
04-03-2008 4:47 AM
Hi,
Declare internal table
it_vbfa with fields mblnr zeile vbelv posnv and
it_vbrp with fields vbelv posnv matnr werks lgort vbeln mwsbp.
declare one more internal tabel which same like itfinal and
itfinal_te[] = itfinal[].
SORT itfinal_te BY bwart.
DELETE itfinal_te where bwart NE '601'.
IF NOT itfinal_te[] is initial.
select mblnr zeile vbelv posnv
from vbfa into table it_vbfa
FOR ALL ENTRIES IN itfinal_te
where vbeln = itfinal_te-mblnr and
posnn = itfinal_te-zeile and
vbtyp_v = 'J'.
select vbelv posnv matnr werks lgort vbeln mwsbp
from vbrp into table it_vbrp
FOR ALL ENTRIES IN itfinal_te
where vgbel = itfinal_te-vbelv and
vgpos = itfinal_te-posnv and
matnr = itfinal_te-matnr and
werks = itfinal_te-werks and
lgort = itfinal_te-lgort.
CLEAR itfinal_te.
FREE itfinal_te..
ENDIF.
loop at itfinal where bwart = '601'.
READ TABLE it_vbfa WITH KEY vbeln = itfinal-vbeln
posnn = itfinal-zeile.
IF sy-subrc EQ 0.
MOVE : it_vbfa-vbelv TO itfinal-vbelv,
it_vbfa--posnv TO itfinal-posnv.
ENDIF.
like you do for vbrp table.
MODIFY table itfinal transporting put new values here(which are passed to itfinal) .
ENDLOOP.
04-03-2008 4:52 AM
Hi
Instead of writing select statement in side the loop.
try to bring those selec statement, such as :
move all the itfinal entries into some temp internal table it_temp where bwart = 601.
or else u can use the itfinal directly by delecting all entries
where bwart <> 601.
select vbelv
posnv
from vbfa into table it_vbfa
for all entries in table it_temp
where vbeln = it_temp-mblnr and
posnn = it_temp-zeile and
vbtyp_v = 'J' and
select vbeln
mwsbp
from vbrp into it_vbrp
where vgbel = it_temp-vbelv and
vgpos = it_temp-posnv and
matnr = it_temp-matnr and
werks = it_temp-werks and
lgort = it_temp-lgort.
loop at itfinal where bwart = 601.
read table it_vbfa where <condition>
if sy-subrc = 0
move required fields
endif.
read table it_vbrp where <condition>
if sy-subrc = 0.
move required fields
endif.
call function module.
modify itfinal.
endloop.
cheers!!!