Skip to Content
0
Former Member
May 28, 2008 at 07:20 PM

Query problem.

35 Views

Question1): How to optimize this query.

SELECT ZBRNM PRODH SUM( ZBIL1 ) SUM( ZSTD1 ) INTO TABLE IT_BRAND

FROM CF951

WHERE

YEARB = LV_PREYEAR AND PERDE = LV_PERDE AND VERSIO = '001' AND PLACTI

='0'

GROUP BY ZBRNM PRODH

ORDER BY ZBRNM.

LOOP AT IT_BRAND.

LV_PREMARGIN = ( IT_BRAND-SUMBIL1 ) - ( IT_BRAND-SUMSTD1 ).

LV_PREPERMARGIN = ( LV_PREMARGIN / IT_CURRBRAND-SUMBIL1 ) * 100.

WRITE: / IT_BRAND-ZBRNM, IT_BRAND-PRODH, IT_BRAND-SUMBIL1,

IT_BRAND-SUMSTD1,

LV_PREMARGIN.

ENDLOOP.

Question 2) In given query perde is fiscal period and i want to run this query from different fiscal period ( i means to say for 11 times for a year). how to give the range in where clasue.

If my question is not clear let me know i will give more details.