2007 Aug 10 8:01 AM
I need a standard function module that takes a date and time as input, I then add say hours/minutes/days/weeks/months/years to that function module, it then converts it to the corresponding date and time
2007 Aug 10 8:05 AM
2007 Aug 10 8:05 AM
2007 Aug 10 8:05 AM
Hi
try this fm
<b>RP_CALC_DATE_IN_INTERVAL</b>
Regards
Preeti
<b>
Reward for useful reply</b>
2007 Aug 10 8:07 AM
Hi
Date, Month and Popup Related Function Modules
Date/Month Related Function Modules:
DATE_COMPUTE_DAY Finds day of the month
DATE_CONV_EXT_TO_INT - user formatted date is converted to system date
DATE_GET_WEEK - convert date into year + week format
DATE_TO_DAY gives weekday from date
DATE_IN_FUTURE takes number of days and date - gives future date in user format and system format
MONTH_PLUS_DETERMINE add or subtract month from a date
RP_CALC_DATE_IN_INTERNAL add/subtract year/month/days from a date
WEEK_GET_FIRST_DAY take input as YYYYWW and it gives first day of the week.
MONTH_NAMES_GET language is only parameter. Returns internal table with months.
MONTH_PLUS_DETERMINE subtract months from date
1.To get a date from a given date +/- period. Input : Date & Period (No. of Days) Output : Calculated Date
Please go through the Function Module "RELATIVE_DATE_CALCULATE". Remember to enter the date in 'yyyymmdd' format in the start date field.
2.if the days variable is integer and other 2 like sy-datum, the math below yields the number of days to yo..
start date = '23.07.2003'
End date = '23.09.2003'
Days = enddate - Start date.
3. Please go through the Functions Module , it gives date as well as time difference, though U may have to enter time as well.
SD_DATETIME_DIFFERENCE
4. with this FM you can get dates between two dates : Function Module
RP_CALC_DATE_IN_INTERVAL
5. go into SE37 and search on 'difference between dates', one of these 3 keywords or a combination between the 3 will give you a function module.
6. Date Upper & Lower limit: the lower is obviously the 1st of the month. To get the upper use function module END_OF_MONTH_DETERMINE.
7. to get the logon user setting date dynamically : Using offsets move it into a date field,obviously in the format yyyymmdd. then move it into a char(10) field. U get the data in char(10) using the current user's setting.
ex:: w_date type d value '20030822',
w_char(10).
say logon user setting is mm/dd/yyyy.
write w_date to w_char. w_char will have the value 08/22/2003.
You can use the result of the move stmt in bdc table.
8. Check this FM
"/SAPDMC/LSM_DATE_CONVERT "
9.statements:
1. CONVERT DATE f1 INTO INVERTED-DATE f2.
2. CONVERT INVERTED-DATE f1 INTO DATE f2.
Calculates the nine's complement of the internal date format (YYYYMMDD - for more information about internal display, meaning and initial values of types and places it in the field f2.
For example, 19950511 ==> 80049488 or 80049488 ==> 19950511.
In the inverse date format, the most recent date has the numerically smallest value. You can make use of this effect when sorting dates.
10. GET TIME STAMP : returns the timestamp in short or long form. The short form contains the current date and time :
DATA:
s_tst TYPE timestamp,
l_tst TYPE timstampl,
tzone TYPE timezone.
GET TIME STAMP FIELD s_tst. "Short form
GET TIME STAMP FIELD l_tst. "Long form
tzone = 'UTC '. "Time zone
WRITE: / s_tst TIME ZONE tzone,
/ l_tst TIME ZONE tzone.
Then, The short form might then contain the value 19980204163520, while the long form has the value 19980204163520,1234560.
The time stamp can be converted by using CONVERT TIME STAMP and CONVERT DATE
11.Some system fields: DATLO Local date for user DATUT Global date related to UTC (GMT) TSTLO Timestamp (date and time) for user TSTUT Timestamp (date and time) related to UTC (GMT)
12. Check the site http://funciones.sapabap.cc for functions like DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP.
Works well when validating dates being passed in from other systems.
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
DATE_GET_WEEK will return the week that a date is in.
DATE_IN_FUTURE Calculate a date N days in the future.
DAY_ATTRIBUTES_GET Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuesday), whether the day is a holiday, and more.
F4_DATE for popping up calendar for date help on value request
RH_GET_DATE_DAYNAME return the day based on the date provided
RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
RP_LAST_DAY_OF_MONTHS Determine last day of month
WEEK_GET_FIRST_DAY For a given week (YYYYMM format), this function returns the date of the Monday of that week.
Check this link too
http://www.erpgenie.com/abap/functions.htm
Reward all helpfull answers
Regards
Pavan