‎2007 Aug 13 9:21 AM
in selection screen i require as
Document Date 07/14/2007 to 08/13/2007
but my code is displaying like this 07/01/2007 08/13/2007
what to change in my code
INITIALIZATION.
LAST_MONTH_LAST_DAY = SY-DATUM.
LAST_MONTH_LAST_DAY+6(2) = 01.
LAST_MONTH_LAST_DAY = LAST_MONTH_LAST_DAY - 1.
DATE1 = LAST_MONTH_LAST_DAY .
DATE1+6(2) = 01. "set the date to first of month
MOVE: 'BT' TO s_audat-OPTION,
DATE1 TO s_audat-LOW,
sy-datum TO s_audat-HIGH.
APPEND s_audat.
‎2007 Aug 13 10:04 AM
Hi! sravanthigopal
data: from_date like sy-datum,
to_date like sy-datum.
Initialization.
to_date = sy-datum.
from_date = from_date - 30.
MOVE 'I' to so_date-sign.
MOVE 'EQ' to so_date-option.
MOVE from_date to so_date-low.
MOVE to_date to so_date-high.
append so_date.
If its Useful Reward it.
Thanks,
Nagulan.
‎2007 Aug 13 9:35 AM
Hi,
You can perhaps use a fonction module to compute your date :
One month less
CALL FUNCTION 'SALP_CALC_DATE'
EXPORTING
IN_RECTYPE = 'M'
IN_NBR_DWXMQY = -1
IN_DATE = sy-datum
IMPORTING
OUT_DATE = result.
One day more
CALL FUNCTION 'SALP_CALC_DATE'
EXPORTING
IN_RECTYPE = 'D'
IN_NBR_DWXMQY = +1
IN_DATE = result
IMPORTING
OUT_DATE = result.
Hopte it helps,
Regards,
Mathieu
‎2007 Aug 13 9:43 AM
Hi Mathieu ILHE ,
can u include my code in the function modules, coz i dont know what parameters i should import n export
‎2007 Aug 13 9:50 AM
The data <b>result</b> will contain sy-datum - 1 month + 1 day.
Is it what you need ?
Just replace <b>result </b>by your <b>data1</b>.
INITIALIZATION.
One month less
CALL FUNCTION 'SALP_CALC_DATE'
EXPORTING
IN_RECTYPE = 'M'
IN_NBR_DWXMQY = -1
IN_DATE = sy-datum
IMPORTING
OUT_DATE = data1.
One day more
CALL FUNCTION 'SALP_CALC_DATE'
EXPORTING
IN_RECTYPE = 'D'
IN_NBR_DWXMQY = +1
IN_DATE = data1
IMPORTING
OUT_DATE = data1.
MOVE: 'BT' TO s_audat-OPTION,
DATE1 TO s_audat-LOW,
sy-datum TO s_audat-HIGH.
APPEND s_audat.
Regards,
Mathieu
‎2007 Aug 13 10:07 AM
Hi Mathieu,
if i use the function module it is showing the below one
it is showing 07/14/2008 08/13/2007 instead of -
> incorrect
07/14/2007 08/13/2007 -
>correct should show same year
‎2007 Aug 13 9:53 AM
Hi Gopal,
use the below logic to get the required date... hope this will help u in solving the issue.
DATE16(2) = sy-datum6(2) + 01.
<b>Give points if useful.</b>
‎2007 Aug 13 9:56 AM
Hi Dhamodaran,
Using this method is that you will have problems at end of month...
How does it work on the 31th July ?
Mathieu
‎2007 Aug 13 10:04 AM
Hi! sravanthigopal
data: from_date like sy-datum,
to_date like sy-datum.
Initialization.
to_date = sy-datum.
from_date = from_date - 30.
MOVE 'I' to so_date-sign.
MOVE 'EQ' to so_date-option.
MOVE from_date to so_date-low.
MOVE to_date to so_date-high.
append so_date.
If its Useful Reward it.
Thanks,
Nagulan.
‎2007 Aug 13 10:10 AM
Hi..
This is the code for u.
SELECT-OPTIONS : S_DATE FOR SY-DATUM.
INITIALIZATION.
S_DATE-SIGN = 'I'.
S_DATE-OPTION = 'BT'.
S_DATE-LOW = SY-DATUM.
S_DATE-LOW+6(2) = '01'. "First day of Current month
S_DATE-HIGH = SY-DATUM. "Current Date
APPEND S_DATE.
<b>Reward if Helpful</b>
‎2007 Aug 13 12:44 PM
hi Gopal,
<b>try this code this will work for all date...</b>
<b>give pionts if use ful</b>
data : LAST_MONTH_LAST_DAY type sy-datum,
date1 type sy-datum.
Data : input type sy-datum,
last_date_of_this_month type sy-datum,
date2 type i.
input = '20070731'.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = input
IMPORTING
LAST_DAY_OF_MONTH = last_date_of_this_month
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
date2 = last_date_of_this_month+6(2).
LAST_MONTH_LAST_DAY = input.
lAST_MONTH_LAST_DAY+6(2) = 01.
if ( INPUT+6(2) < date2 ).
LAST_MONTH_LAST_DAY = LAST_MONTH_LAST_DAY - 1.
DATE1 = LAST_MONTH_LAST_DAY .
DATE16(2) = input6(2) + 01. "set the date to first of month
else.
DATE1 = LAST_MONTH_LAST_DAY .
endif.
write : / input, DATE1.