Skip to Content
0
Former Member
Nov 11, 2007 at 12:02 PM

how to minimize the code

27 Views

My issue is I want to take 1 month data.

ie for a particular material I am checking in a 'z' table where some lot is created for 1st day of a month till last day of a month(ie 1st to 31st).

In this case it takes a lot of time for 7 materials in dev server itself. ie the loop runs for 31*7 times. How can i do this such that exec time can be reduced.

my code is:

WHILE date1 <= date2.

clear: it_zqminv[],it_ekko1[].

SELECT single * FROM zqminvoice where

lifnr = p_lifnr and

matnr = it_ekpo-matnr and

werk = it_ekpo-werks and

bldat = date1 and

art = '94'.

IF sy-subrc = 0.

IF date1+6(2) = '01'.

WRITE :72(2) d01 HOTSPOT ON COLOR 3 INTENSIFIED ON,

74 sy-vline.

elseif date1+6(2) = '02'.

WRITE :75(2) d02 HOTSPOT ON COLOR 3 INTENSIFIED ON,

77 sy-vline.

elseif date1+6(2) = '03'.

WRITE :78(2) d03 HOTSPOT ON COLOR 3 INTENSIFIED ON,

80 sy-vline.

elseIF date1+6(2) = '04'.

WRITE :81(2) d04 HOTSPOT ON COLOR 3 INTENSIFIED ON,

83 sy-vline.

elseif date1+6(2) = '05'.

WRITE :84(2) d05 HOTSPOT ON COLOR 3 INTENSIFIED ON,

86 sy-vline.

elseIF date1+6(2) = '06'.

WRITE :87(2) d06 HOTSPOT ON COLOR 3 INTENSIFIED ON,

89 sy-vline.

elseIF date1+6(2) = '07'.

WRITE :90(2) d07 HOTSPOT ON COLOR 3 INTENSIFIED ON,

92 sy-vline.

elseIF date1+6(2) = '08'.

WRITE :93(2) d08 HOTSPOT ON COLOR 3 INTENSIFIED ON,

95 sy-vline.

elseIF date1+6(2) = '09'.

WRITE :96(2) d09 HOTSPOT ON COLOR 3 INTENSIFIED ON,

98 sy-vline.

elseIF date1+6(2) = '10'.

WRITE :99(2) d10 HOTSPOT ON COLOR 3 INTENSIFIED ON,

101 sy-vline.

elseIF date1+6(2) = '11'.

WRITE :102(2) d11 HOTSPOT ON COLOR 3 INTENSIFIED ON,

104 sy-vline.

elseIF date1+6(2) = '12'.

WRITE :105(2) d12 HOTSPOT ON COLOR 3 INTENSIFIED ON,

107 sy-vline.

elseIF date1+6(2) = '13'.

WRITE :108(2) d13 HOTSPOT ON COLOR 3 INTENSIFIED ON,

110 sy-vline.

elseIF date1+6(2) = '14'.

WRITE :111(2) d14 HOTSPOT ON COLOR 3 INTENSIFIED ON,

113 sy-vline.

elseIF date1+6(2) = '15'.

WRITE :114(2) d15 HOTSPOT ON COLOR 3 INTENSIFIED ON,

116 sy-vline.

elseIF date1+6(2) = '16'.

WRITE :117(2) d16 HOTSPOT ON COLOR 3 INTENSIFIED ON,

119 sy-vline.

elseIF date1+6(2) = '17'.

WRITE :120(2) d17 HOTSPOT ON COLOR 3 INTENSIFIED ON,

122 sy-vline.

elseIF date1+6(2) = '18'.

WRITE :123(2) d18 HOTSPOT ON COLOR 3 INTENSIFIED ON,

125 sy-vline.

elseIF date1+6(2) = '19'.

WRITE :126(2) d19 HOTSPOT ON COLOR 3 INTENSIFIED ON,

128 sy-vline.

elseIF date1+6(2) = '20'.

WRITE :129(2) d20 HOTSPOT ON COLOR 3 INTENSIFIED ON,

131 sy-vline.

elseIF date1+6(2) = '21'.

WRITE :132(2) d21 HOTSPOT ON COLOR 3 INTENSIFIED ON,

134 sy-vline.

elseIF date1+6(2) = '22'.

WRITE :135(2) d22 HOTSPOT ON COLOR 3 INTENSIFIED ON,

137 sy-vline.

elseIF date1+6(2) = '23'.

WRITE :138(2) d23 HOTSPOT ON COLOR 3 INTENSIFIED ON,

140 sy-vline.

elseIF date1+6(2) = '24'.

WRITE :141(2) d24 HOTSPOT ON COLOR 3 INTENSIFIED ON,

143 sy-vline.

elseIF date1+6(2) = '25'.

WRITE :144(2) d25 HOTSPOT ON COLOR 3 INTENSIFIED ON,

146 sy-vline.

elseIF date1+6(2) = '26'.

WRITE :147(2) d26 HOTSPOT ON COLOR 3 INTENSIFIED ON,

149 sy-vline.

elseIF date1+6(2) = '27'.

WRITE :150(2) d27 HOTSPOT ON COLOR 3 INTENSIFIED ON,

152 sy-vline.

elseIF date1+6(2) = '28'.

WRITE :153(2) d28 HOTSPOT ON COLOR 3 INTENSIFIED ON,

155 sy-vline.

elseIF date1+6(2) = '29'.

WRITE :156(2) d29 HOTSPOT ON COLOR 3 INTENSIFIED ON,

158 sy-vline.

elseIF date1+6(2) = '30'.

WRITE :159(2) d30 HOTSPOT ON COLOR 3 INTENSIFIED ON,

161 sy-vline.

elseIF date1+6(2) = '31'.

WRITE :162(2) d31 HOTSPOT ON COLOR 3 INTENSIFIED ON,

164 sy-vline.

endif.

moreover i am displaying from 1 to 31 days in heading. if there is data in 3rd day of the month a 'X' will be displayed there.