‎2007 Jan 29 4:42 AM
hi
is there any function module that gives previous month and year? for eg. if the input is 01.2007 (monyr), 12.2006 should be exported..thanks
‎2007 Jan 29 4:48 AM
<b>RS_VARI_V_L_LAST_MONTH</b> Returns last day of last month.
<b>RS_VARI_V_1_LAST_MONTH</b> Returns first day of the last month.
‎2007 Jan 29 4:48 AM
<b>RS_VARI_V_L_LAST_MONTH</b> Returns last day of last month.
<b>RS_VARI_V_1_LAST_MONTH</b> Returns first day of the last month.
‎2007 Jan 29 4:49 AM
Hi sathish,
u just have to give the date from which u have to go back and the number of months..in th follwing fm
CCM_GO_BACK_MONTHS
from the exported value u can take the year or month or both
hope this helps,
all the best,
sampath
award points if helpful
‎2007 Jan 29 4:52 AM
Hi Sathish,
U can use <b>BKK_ADD_MONTH_TO_DATE</b>.
Pass the old date and months to be added as '-1'. Suppose if u pass old date as 01.01.2007 and months as '-1', then ur output will be 01.12.2006. Take only the month and year.
-Satya Priya
‎2007 Jan 29 4:54 AM
Hi Satish,
Try these function modules.
RS_VARI_V_1_LAST_MONTH
RS_VARI_V_LAST_MONTH
RS_VARI_V_L_LAST_MONTH
Regards,
Ramesh
*If reply is helpful award the points
‎2007 Jan 29 4:58 AM
Hi,
Use this FM.
CALCULATE_DATE.
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
DAYS = '0'
MONTHS = '-1'
START_DATE = SY-DATUM
IMPORTING
RESULT_DATE = lv_date.
write lv_date+0(4).
write lv_date+4(2).
Rgds,
Prakash
‎2007 Jan 29 5:06 AM
hi sathish,
the function module <u><b>RS_VARI_V_LAST_MONTH</b></u> will give u the previous month
‎2007 Jan 29 5:15 AM
hi,
this does it without a FM.
Try out.
DATA: fdate TYPE sy-datum.
parameter: ldate TYPE sy-datum.
WRITE:/ 'Current Date - ', ldate.
ldate+6(2) = '01'.
ldate = ldate - 1.
fdate = ldate.
fdate+6(2) = '01'.
WRITE:/ 'First Date - ' , fdate.
WRITE:/ 'Last Date - ' , ldate.
Reward points if helpful,
Bijal
‎2007 Jan 29 5:16 AM
hi,
just try this.
data: wa_date like sy-datum.
data: month(2),
year(4).
call function 'RP_CALC_DATE_IN_INTERVAL'
exportingdate = sy-datum
days = 0
months = 1
signum = '-'
years = 0
importing
calc_date = wa_date.
month = wa_date+4(2).
year = wa_date+0(4).Regards
Anver
‎2007 Jan 29 5:16 AM
hi,
just try this.
data: wa_date like sy-datum.
data: month(2),
year(4).
call function 'RP_CALC_DATE_IN_INTERVAL'
exportingdate = sy-datum
days = 0
months = 1
signum = '-'
years = 0
importing
calc_date = wa_date.
month = wa_date+4(2).
year = wa_date+0(4).Regards
Anver
‎2007 Jan 29 5:18 AM
Hi Sathish,
check out these fm:
CCM_GO_BACK_MONTHS
RS_VARI_V_LAST_MONTH
CALCULATE_DATE
this will give you the previous month.
‎2007 Jan 29 5:25 AM
friends,
thanks for your answers...i was expecting a fm that would only return previous monyr (200612 if i give 200701)..but anyway, i can use any of your fms and get the result..BKK_ADD_MONTH_TO_DATE seems to be simple as there are only 2 import parameters