‎2008 Mar 03 6:16 AM
hi experts ,
i have date_high and number_of_days.
i want to calculate date_low by subtacting number_of_days from date_high.
can anyone please tell me the Fumction Module for the same ?
thanx in advance
akanksha dhanerwal sharma
‎2008 Mar 03 6:20 AM
Hi,
SD_DATETIME_DIFFERENCE - This is the function module . In this module we are givng the date and time.
We will get the difference between higher date and lower date and time.
Thanks,
Sankar M
‎2008 Mar 03 6:22 AM
Hi
Use Below Fm
/SAPHT/DRM_CALC_DATE
Pass No of Days For Days
and Sign must be - Minus..
Hope this helps.
Tahnks
Praveen
‎2008 Mar 03 6:36 AM
‎2008 Mar 03 6:22 AM
hi,
COPF_DETERMINE_DURATION Calculates difference between date and time
DAYS_BETWEEN_TWO_DATES Calculates number of days between two dates
FIMA_DAYS_AND_MONTHS_AND_YEARS Calculates the difference between two dates
HR_HK_DIFF_BT_2_DATES Days, months and years between two dates
MONTH_PLUS_DETERMINE Adds or subtracts months to/from a date
RP_CALC_DATE_IN_INTERVAL Adds/subtracts years, months, days to/from date
SD_DATETIME_DIFFERENCE Difference in days and time for two dates
SUBTRACT_TIME_FROM_DATE Subtracts months, days, and years from a given date
Hope this helps.
‎2008 Mar 03 6:23 AM
Hi,
Use FM:CONVERSION_EXIT_SDATE_OUTPUT.
or FM:CONVERSION_EXIT_IDATE_OUTPUT
or
use below fm: MONTH_NAMES_GET .
data: it_months like t247 occurs 0 with header line.
data: v_text(20).
*date:v_date like sy-datum value '01102007'.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
TABLES
MONTH_NAMES = it_months
EXCEPTIONS
MONTH_NAMES_NOT_FOUND = 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.
read table it_months with key mnr = sy-datum+4(2).
if sy-subrc = 0.
concatenate sy-datum6(2) '-' it_months-ltx0(3) '-' sy-datum+04) into v_text.
endif.
‎2015 May 08 5:48 AM
Hello Akanksha,
If the Given date is newer than the expected date, try this code:
//PARAMETERS: DATE1 TYPE D,
DIFF TYPE I.
DATA DATE2 TYPE D.
DATE2 = DATE1 - DIFF.
WRITE:/ 'Expected Date', DATE2.//
Here DATE1 is the Given date and DATE2 is the expected date.
And if you want to get newer and older both dates, try this:
WRITE:/ 'In XPCT field put 0 for future date and put 1 for past dates'.
PARAMETERS: DATE1 TYPE D,
DIFF TYPE I,
XPCT TYPE I.
DATA: DATE2 TYPE D,
DATE3 TYPE D.
DATE2 = DATE1 - DIFF.
DATE3 = DATE1 + DIFF.
IF XPCT = 0.
WRITE:/ 'Expected Date', DATE3.
ELSEIF XPCT = 1.
WRITE:/ 'Expected Date', DATE2.
ENDIF.
Hope this helps.Best of luck.
Regards,
Debayan
‎2015 May 08 6:43 AM
Hello Akansha Sharma.
Your requirement will be met just by simple arithmetic operation.
DATE_LOW = DATE_HIGH - NUMBER_OF_DAYS.
Regards.