Question:
Hi Guys,
I have a question.
I am working with a query, in this query the user enter a month at the beginning, also I have a formula that I need to call a routine or function to return me the total days of the month that the user entered.
I created a variable ('HIV_AVSY') in the query that calls the following routine:
WHEN 'HIV_AVSY'.
mes_actual = sy-datum+4(2).
CASE mes_actual.
WHEN '01' or '03' or '05' or '07' or '08' or '10' or '12'.
dias_mes = '31'.
WHEN '04' or '06' or '09' or '11'.
dias_mes = '30'.
WHEN others.
dias_mes = '28'.
ENDCASE.
Mes Requerido = dias_mes .
CLEAR l_s_range.
l_s_range-low = Mes Requerido.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
EXIT.
But the problem is that always return 30 days and if I enter Feb at the beginnig is the same number of days 30.
I would appreciate any help.
Thks.
EV
Answer:
Please do not double-post. I deleted the duplicate entry.
_________________
SapFans Moderator
NetWeaver ‘04–SAP Web AS for ORACLE certified
Search: /forums/search.php
SAP Notes: http://service.sap.com/notes
SAP Help: http://help.sap.com
Basic Rules: /forums/viewtopic.php?t=222759
Answer:
mes_actual = sy-datum+4(2).
But the problem is that always return 30 days and if I enter Feb at the beginnig is the same number of days 30.
It's because you calculate number of days in current system date (April).
Try something like this:
WHEN 'HIV_AVSY'.
CLEAR: l_s_range, e_t_range, wa_range.
REFRESH: e_t_range.
IF i_step = 2.
LOOP AT i_t_var_range INTO wa_range WHERE vnam = '<variable name containing entered month>'.
ENDLOOP.
MOVE wa_range-low+4(2) TO mes_actual.
CASE mes_actual.
...
ENDIF.
Denis L.
Answer:
there is a error in the sintaxis, this is the message:
The field "WA_RANGE" is unknown, but there are the following fields with similar names: "E_T_RANGE" and "L_S_RANGE".
which one should I use?
thks.
EV
Answer:
DATA: wa_range TYPE rrrangeexit.
Answer:
hello,
you're ignoring one aspect : what about leap years ?
Didier
Answer:
Easier than your initial idea.
Call function SLS_MISC_GET_LAST_DAY_OF_MONTH to get the last day of month from the input date.
Then, take only the day from this last day (result_day+6(2)).
Regards.