2006 Nov 13 10:12 AM
Hi gurus!
I need a Function that retun the next month in the format: yyyymmdd (without points) if it´s possible or yyyymm. The first option is better than the second one. My import parameter has the format: yyyymmdd.
Maybe, I'll be useful a similar function but with the next day.
Thanks in advance
2006 Nov 13 11:41 AM
Hi,
Refer to my answer.
<b>Put a break-point at</b>
*--Output format in yyymmdd (without points)
WRITE : future_date.You will have future_date in YYYYMMDD format.
Regards,
AS
2006 Nov 13 10:17 AM
Try with FM /BEV4/PLPS__ADD_MONTH_TO_DATE or SG_PS_ADD_MONTH_TO_DATE.
But most of the FM accepts the dates in sy-datum format only.
So whatever date format you have you can convert them into sy-datum form then try to use above FMs.
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers
2006 Nov 13 10:17 AM
data: wa_date like sy-datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 0
months = 1
signum = '+'
years = 0
importing
calc_date = wa_date.
write: wa_date.kishan negi
2006 Nov 13 10:19 AM
Hi,
check out the function module
RE_ADD_MONTH_TO_DATE.
Regards,
Nagraj
2006 Nov 13 10:19 AM
hi,
simple chk this.
data : wa_date type sy-datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 0
months = 1 --------------------> give ur required month
years = 0
signum = '+' -------------> add sign
importing
calc_date = wa_date.
write :/ wa_date. -> next month date in sy-datum format.
rgds
Anver
if hlped pls mark points
2006 Nov 13 10:21 AM
Hi
PARAMETERS: P_DAY LIKE SY-DATUM.
DATA: NEXT_MONTH(6).
DATA: LAST_DAY LIKE Y-DATUM.
* Set the first day
LAST_DAY = P_DAY.
LAST_DAY+6(2) = '01'.
* Get last day
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = LAST_DAY
IMPORTING
LAST_DAY_OF_MONTH = LAST_DAY.
* Get next month
LAST_DAY = LAST_DAY + 1.
NEXT_MONTH = LAST_DAY(6).Max
2006 Nov 13 10:21 AM
Hi ,
Check this out..
Function module MONTH_PLUS_DETERMINE
<b>Import parameters Value</b>
MONTHS 1
OLDDATE 13.11.2006
<b>Export parameters Value</b>
NEWDATE 13.12.2006Check out this code..
REPORT zztest_date .
DATA :
months_offest(2) TYPE c,
present_date TYPE sy-datum,
future_date TYPE sy-datum.
*--Present Date
present_date = sy-datum.
*--Future date with Months as offset
months_offest = '1' . "Date after 1 month
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = months_offest
olddate = present_date
IMPORTING
newdate = future_date.
*--Output format in yyymmdd (without points)
WRITE : future_date.
Regards,
AS
Message was edited by:
Arun Sambargi
2006 Nov 13 10:34 AM
try this fm
CALL FUNCTION 'HR_BR_ADD_MONTH_TO_DATE'
EXPORTING
DMM_DATIN = dateinput (like sy-datum)
DMM_COUNT = 1
DMM_OPER = '+'
DMM_POS = 0
IMPORTING
DMM_DAOUT = data output (like sy-datum)
EXCEPTIONS
UNKNOWN = 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.
it will add one month to the input date.
shiba prasad
2006 Nov 13 10:37 AM
just execute the code ..
************************
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE RSINTRANGE.
DATA: END OF intern.
data : date like sy-datum,
datex(10) type c.
CALL FUNCTION 'RS_VARI_V_1_NEXT_MONTH'
IMPORTING
P_DATE = date
TABLES
p_intrange = intern.
write:/ date.
datex = date.
write:/ datex.regards,
VIjay
2006 Nov 13 10:47 AM
just execute teh code ..
my prev post will give u the answer ..
this is the more precise way for getting the date to internal format ..
regards,
VIjay
-
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE RSINTRANGE.
DATA: END OF intern.
data : date like sy-datum,
datex(10) type c.
CALL FUNCTION 'RS_VARI_V_1_NEXT_MONTH'
IMPORTING
P_DATE = date
TABLES
p_intrange = intern.
write:/ date.
*datex = date.
write date to datex.
*write:/ datex.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = datex
IMPORTING
DATE_INTERNAL = datex
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 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.
write:/ datex.regards,
VIjay
2006 Nov 13 11:35 AM
Hi all,
Thanks for your help but the problem hasn´t been solved.
I need that the function return the format YYYYMMAA
Thanks
2006 Nov 13 11:41 AM
Hi,
Refer to my answer.
<b>Put a break-point at</b>
*--Output format in yyymmdd (without points)
WRITE : future_date.You will have future_date in YYYYMMDD format.
Regards,
AS
2006 Nov 13 11:59 AM