Hi
The date is a numeric string, so you can use the main comands manage a number and a string
If the the first date of the interval is the first day of the current period, you can subtract 1 to the date:
DATA LAST_DAY_PREV TYPE SY-DATUM. LAST_DAY_PREV = FIRST_DAY_CURR - 1.
The date is string with format YYYYMMDD, so yuo can calculate the first day from the last one, it need to replace the days:
DATA FIRST_DAY_PREV TYPE SY-DATUM. FIRST_DAY_PREV = LAST_DAY_PREV. FIRST_DAY_PREV+6(2) = '01'.
Of course there are many ways and function module, i think you can look for them by google
Where you want to add this logic? In Sale Order? In condition record? Please explain the business requirement so that suitable suggestions can be given from functional point of view if it is made available.
Hay Hi,
You can use the FM "RP_CALC_DATE_IN_INTERVAL" to get the last month 1st day & Fm " OIL_LAST_DAY_OF_PREVIOUS_MONTH " to get the last day of previous month .
for the further detail u can visit on following link.
if you have payroll active you could simly read T549Q.
or:
Hi Las W,
There are so many function module you can utilize to achieve this,
Procedure:
1. You can get input dates from user
2. Pass loc_var_range-low values to RE_ADD_MONTH_TO_DATE. with input MONTHS : -1 OLDDATE : loc_var_range-low
3. It will give output as
1. RE_ADD_MONTH_TO_DATE
----------------------------------------------------------------------------------------------------
2. BCA_US_DATES_CALC_DATE
Pass the following
I_START_DATE = 'Todays Date'
I_TERM = '-6' "Yes '- 6' (it actually Works)
I_PERIODUNIT = any one from the list
1 Calendar Days
2 Weeks
3 Months
4 Quarter
5 Year
It will get you the date
----------------------------------------------------------------------------------------------------
3.RP_CALC_DATE_IN_INTERVAL
input:
DATE 02.11.2016
DAYS 00 (give how many days back ex; 12,30,200)
MONTHS 01 (give how many months back ex: 02,10,03,04)
SIGNUM - (give +to add or - to previous)
YEARS 00
Export parameters Value
CALC_DATE 02.10.2016 (OUTPUT)
----------------------------------------------------------------------------------------------------
4. CCM_GO_BACK_MONTHS
CURRDATE 11.11.2016
BACKMONTHS 001
output : 11.10.2016
-----------------------------------------------------------------------------------------------------
5. This will give last date of month:
RS_VARI_V_L_LAST_MONTH
input:
SYSTIME 01.11.2016
output:
P_DATE 31.10.2016
Add comment