09-24-2008 7:25 AM
Hi all,
In my selection-screen what i want is for the selection parameter "Selection period month" the default value to be the previous month.
For example today is 24.09.2008 so the default value of this field has to be 200808 instead of 200809 today.
please tell me how should i do this.
thanks in advance.
09-24-2008 7:30 AM
Hi,
Try this.
Use the function module 'HR_JP_ADD_MONTH_TO_DATE' and give the value for IV_MONTHCOUNT as -1 to get the previous month.
Sharin.
09-24-2008 7:30 AM
Hi,
Try this.
Use the function module 'HR_JP_ADD_MONTH_TO_DATE' and give the value for IV_MONTHCOUNT as -1 to get the previous month.
Sharin.
09-24-2008 7:31 AM
09-24-2008 7:32 AM
F1 on INITIALIZATION?(Information)
And concatenate with above reply to get the previous month
09-24-2008 7:36 AM
write the code in initialization and u can use this function module 'HR_JP_ADD_MONTH_TO_DATE'
09-24-2008 7:40 AM
09-24-2008 7:42 AM
Combined two posts into one. Does that account for added information??
pk
09-24-2008 7:48 AM
09-24-2008 7:46 AM
Hi,
Try this code
************************************************************
PARAMETERS : date(6) TYPE c.
DATA : datum TYPE sy-datum,
year(4) TYPE n,
month(2) TYPE n.
INITIALIZATION.
datum = sy-datum.
year = datum+0(4).
month = datum+4(2).
IF month EQ '01'.
month = '12'.
year = year - 1.
ELSE.
month = month - 1.
ENDIF.
CONCATENATE year month INTO date.
BREAK-POINT.
************************************************
Regards
Bala Krishna
09-24-2008 8:13 AM
Hi,
Check the following code:
data: f_date type sy-datum,
f_dd(2) type c,
f_mm(2) type c,
f_yyyy(4) type c,
f_pdt type sy-datum.
parameters: p_date like sy-datum.
initialization.
f_date = sy-datum.
f_dd = sy-datum+6(2).
f_mm = sy-datum+4(2) - 1.
f_yyyy = sy-datum+0(4).
if f_mm eq 0.
concatenate f_yyyy '12' f_dd into f_pdt.
elseif f_mm eq 1 or
f_mm eq 2 or
f_mm eq 3 or
f_mm eq 4 or
f_mm eq 5 or
f_mm eq 6 or
f_mm eq 7 or
f_mm eq 8 or
f_mm eq 9.
concatenate f_yyyy '0' f_mm f_dd into f_pdt.
else.
concatenate f_yyyy f_mm f_dd into f_pdt.
endif.
p_date = f_pdt.
start-of-selection.
write : / f_date,
/ f_pdt.
Regards,
Bhaskar
Edited by: Bhaskar Chikine on Sep 24, 2008 12:49 PM