05-19-2006 11:46 AM
hi,
i have a select option(s_date) for date field and i want to initialize the s_date-high equal to previous month of last date. for ex: this is the month of may then i want 30-apr-2006.
05-19-2006 12:22 PM
Hi Kiran,
u can also use this code
data:
first_day like sy-datum
<b>Intialization</b>
first_day = sy-datum.
first_day+6(2) = '01'.
first_day = first_day - 1.
now assign the value of first_day to the high value of ur select option
05-19-2006 11:54 AM
hi
Hope the following can be useful
get the month from sy-datum.
decrement it by one, if this value comes 0 take it as 12( this is to take care of January ie 1 - 1 = 0 )
pass the date with the decremented month into FM
SLS_MISC_GET_LAST_DAY_OF_MONTH
Anirban
05-19-2006 12:00 PM
Hi,
lv_day type i,
lv_date_last_month type dats
In the initialize event.
lv_day = sy-datum+0(2).
lv_date_last_month = sy-datum - lv_day.
lv_date_last_month = lv_date_last_month + 1.
s_date-high = lv_date_last_month.
append s_date.
Date calulation is done internally u dont need to worry.
this is the purpose of date data type.
Close the thread if solved.
mark helpful answers
Regards
Message was edited by: Manoj Gupta
05-19-2006 12:00 PM
REPORT ychatest.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_date FOR sy-datum.
SELECTION-SCREEN END OF BLOCK b1 .
INITIALIZATION.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = sy-datum
backmonths = '01'
IMPORTING
newdate = s_date-low.
CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
EXPORTING
i_date = s_date-low
IMPORTING
e_date = s_date-low.
APPEND s_date.
Reward pts if helpful and close thread if solved
Message was edited by: Chandrasekhar Jagarlamudi
05-19-2006 12:03 PM
Hi Kiran,
Use the following code.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = sy-datum
backmonths = '001'
IMPORTING
newdate = lv_date_for_fmonth.
<b>Also, reward points if it helps and close the thread.</b>
Regards,
Amit Mishra
05-19-2006 12:07 PM
Hi,
I have written test program for it.
use this .
PARAMETERS s_date TYPE dats.
DATA : lv_day TYPE i,
lv_date TYPE dats.
initialization.
lv_day = sy-datum+0(2).
lv_date = sy-datum - lv_day.
lv_date = lv_date + 1.
s_date = lv_date.
Please close the thread ; ur problem is solved
and Mark Helpfull Answers
05-19-2006 12:15 PM
05-19-2006 12:16 PM
Hi,
As already some of our friends mentioned, you can use
'CCM_GO_BACK_MONTHS' to get date from previous months and if you want to format it as you have mentioned e.g. 30APR2006 then additionaly use : 'CONVERSION_EXIT_IDATE_OUTPUT' FM
Regards,
Akshay
Note: Pls mark helpful answers
05-19-2006 12:22 PM
Hi Kiran,
u can also use this code
data:
first_day like sy-datum
<b>Intialization</b>
first_day = sy-datum.
first_day+6(2) = '01'.
first_day = first_day - 1.
now assign the value of first_day to the high value of ur select option