Skip to Content
0
Aug 04 at 08:13 AM

improve Query Performance

61 Views

Hello,

I want to improve this statement by adding the If condition ( that in the end ) to the statement it self.

I looked for answers and i found that there is a why to use Case statement with Sum

( I said sum because the if statement is adding )

i appreciate your support ..

SELECT nafaz safaz mafaz aafaz kostl peraf FROM faav_anlp INTO
(anlp-nafaz,anlp-safaz,anlp-mafaz,anlp-aafaz,anlp-kostl,
anlp-peraf)
WHERE bukrs = anlav-bukrs
AND gjahr = sav_gjahr
AND peraf LE sav_poper
AND anln1 = anlav-anln1
AND anln2 = anlav-anln2
AND afaber = bereich1.

CHECK anlp-kostl IN s_kostl[].


IF anlp-peraf = sav_poper.
itab_data-nafaz = itab_data-nafaz + anlp-nafaz + anlp-safaz
+ anlp-mafaz + anlp-aafaz.
ENDIF.
ENDSELECT.