Skip to Content
0
Jun 27, 2012 at 03:02 AM

To get "No Of days in each Month" based on Cal year/month

143 Views

Hi BI gurus,

I am creating a query, which I need to create a Variable Formula (Cust Exit) for getting Number of Days in each month based on User Manual Input (Cal/Month).

My current coding:-

*TO calculate No Of Days in each Month

WHEN 'ZVAR_NO_DAYS_IN_EACH_MONTH'.
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = '0PCALMON'.
CLEAR l_s_range.
zcalyear = loc_var_range-low(4).
zcalmonth2 = loc_var_range-low+4(2).

CONCATENATE zcalyear zcalmonth2 '01' INTO zcalday.

IF zcalmonth2 BETWEEN 01 AND 03.
zcalyear = zcalyear - 1.
ENDIF.

CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = zcalday
IMPORTING
last_day_of_month = zcalday1
EXCEPTIONS
day_in_not_valid = 1.

CONCATENATE zcalyear zcalmonth2 '01' INTO zcalday2.
zdays = zcalday1 - zcalday2 + 1.
l_s_range-low = zdays.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDLOOP.
CLEAR: zcalyear, zcalmonth, zcalmonth2, zdays.

Although the Codes seems fine, when I executed the Query, it actually prompt-up an extra Manual Input fields.


The Calendar Year/Month(*) is OPCALMON, which is correct, but

Another Field prompted for No Of Days in Each Month.

I have double checked and The Formula Variables I created is Cust Exit, not manually entered.

Can anyone point out anything I missed in the code please?

Many thanks,
Vince

Attachments

pastedImage_0.png (21.0 kB)