Fun.module for date diff
Hello,
Is there any function module available for giving the difference between two dates.
For ex:
date1 = 01/30/2000; date2: 02/30/2002
If I query for difference it should in below format :Years & Months.
i.e the difference between date2 & date1 should be shown as 2 years 1 month.
Thanks,
Kanaka
hi,
There is no need of any function module for knowing the differnece in dates.
v_diff_days = date1 - date2.
You get the difference in no of days.
Later you can divide it by 365 and know the difference in years.
v_yrs = v_diff_days/365.
Regards,
Sailaja.
Similar Messages
-
To get fun module for Creating prebooking
Hi friends,
Here is my query,
My requirement is a person will prebook the employees for the events from portal
& i need to provide the RFC for that.
I got 2 fun modules for creating prebookings
1) RH_PARTICIPATION_PREBOOK
2) HRIQ_PARTICIPATION_PREBOOK
but these fun modules POPS UP a window after providing the i/p's to it to select the button of prebooking.......
But these is not possible as the SAP screen can't be popped up in portal....
So how do i proceed with this problem??Hi,
See the source code of FMs. Inside somewhre it must be calling other FM which collects actual data. Use that FM.
Reward if useful! -
Function Modules for Data and Time
Hi all,
I need 2 function modules for date and time. when we pass current data(sy-datum) and current time (sy-uzeit) into function modules, shoud get date in <b>dd/mm/yyyy or dd.mm.yyyy</b> and time in<b> HH:MM:SS</b> formats.
Thanks in advanceHi Ranjith,
i think this will b usefull for you..
SAP Bar Chart Function Modules and what they are used for
Function module
Used for
BARC_GRAPHIC_PBO
Starting bar chart at PBO time, using a graphic profile (parameter PROFILE)
BARC_GRAPHIC_PAI
Analyzing data returned by the graphic
BARC_SET_TIME_AXIS
Setting start and end of time axis
BARC_SET_OPTIONS
Setting options
BARC_ADD_CHART
Creating a chart
BARC_SET_CHART_ATTRIB
Setting chart attributes
BARC_ADD_SECTION
Creating a section on the time axis
BARC_SET_SECTION_ATTRIB
Setting section attributes
BARC_ADD_RIBBON
Adding a ribbon to the time axis
BARC_SET_RIBBON_ATTRIB
Setting attributes for ribbons in the chart
BARC_ADD_GRID
Adding a time grid
BARC_SET_GRID_ATTRIB
Setting grid attributes
BARC_ADD_LAYER
Adding a layer (graphic elements)
BARC_SET_LAYER_ATTRIB
Setting layer attributes
BARC_ADD_LINE
Adding a line
BARC_ADD_CALENDAR
Creating a calendar
BARC_SET_CALENDAR_ATTRIB
Setting attributes for a calendar
BARC_ADD_TIME_PROFILE
Creating time profiles
BARC_SET_TIME_PROFILE_ATTRIB
Setting attributes for time profile
BARC_ADD_INTERVAL
Adding a time interval
BARC_SET_INTERVAL_ATTRIB
Setting time interval attributes
BARC_ADD_TIME_OBJECT
Creating a time object
BARC_CONVERT_DATE
Creating a date string in bar chart format
BARC_REVERT_DATE
Converting a date string in bar chart format to date and time
BARC_ADD_DATELINE
Creating a date line
BARC_SET_DATELINE_ATTRIB
Setting dateline attributes
BARC_GET_PROFILE_CONTENTS
Obtaining profile contents for customizing a chart
BARC_GET_COLUMN_WIDTH
Selecting new column width
BARC_SET_COLUMN_WIDTH
Setting the column width
BARC_GET_TEXTINDEX
Obtaining the text index of a field
BARC_SET_LABELS
Positioning the chart display
BARC_SET_COLUMN_ATTRIB
Setting column attributes
BARC_SET_ROW_ATTRIB
Setting row attributes
BARC_SET_ROW_HEIGHT
Setting the line height
BARC_SET_MAXCHARTS
Setting the maximum number of charts sent
<b>If its usefull reward points
</b> -
Function Module for data retrival for work order clearence (WCA)
Hi All ,
Function Module for data retrival for work order clearence (WCA) for a particular Planning plant and (WCD's).
Thanks.Hi Anne,
BAPI_PRODORD_GET_DETAIL
BAPI_PRODORD_GET_LIST
You can find further FM in Function Group COPRINT and CODR or take F4 on CO* in Function Group
These will serve your purpose.
Cheerz.
Ram -
Hi ALL,
I would like to know the various function modules that can be used for calculating dates.Like first day of month,last day.....etc etc.
Please give me a list of the FM's and not the F4 help option info.
CheersHi ,
Here are a few FM used for date manipulation
<b>DATE_IN_FUTURE </b> Add / Substract days from a given date
<b>HR_SGPBS_ADD_TIME_TO_DATE</b> Find the next date based on input date , addition / sub and month , year ,date
<b>CONVERT_DATE_TO_EXTERNAL</b> Convert date to External format
<b>SG_PS_ADD_MONTH_TO_DATE</b> Find the next date based on input date , addition / sub and month , year ,date
<b>DATE_COMPUTE_DATE</b> For a input date gives the day of the week
<b>DATE_GET_WEEK</b>For an input date ,gives the week as output
<b>WEEK_GET_FIRST_DAY</b> Input year and week output is the first day of the week
<b>WEEKDAY_GET</b> Gives the day range , Monday , Tuesday , ..
<b>RP_CALC_DATE_IN_INTERVAL</b> Calculate Future Date
<b>CALCULATE_DATE</b> Calculate Future Date
<b>FIMA_DAYS_AND_MONTHS_AND_YEARS</b> Difference between two dates
<b>CONVERSION_EXIT_PDATE_INPUT</b> It checks if the date is in future , if yes an error is displayed
Reagrds
Arun -
The i pod module for data transfer
Recently i put i pod into enable disk use function so i could use the i pod for data transfer i went into MY computer then located the i pod service module i went to put it onto my desktop but it said module is being used by another program but it isnt atall. When i put in data like my spreadsheets onto the module dragging them it doesnt appear on the i pod module in the i tunes why is that? What do i have to do to make sure i can see that the data is recieved onto the i pod thanks mr roberts
Hi,
Retrieve data file from presentation server(Upload from PC)
DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
CALL FUNCTION <b>'GUI_UPLOAD'</b>
EXPORTING
filename = i_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
Pls reward points.
Regards,
Ameet -
Any Function module for Date conversion
Hi,
In my output the date is coming like 80999898 but the actual date is 01.01.1900.
Could you please tell me is there any Function module for that.
Regards,
TusharUse the conv. exit CONVERSION_EXIT_INVDT_OUTPUT for this purpose.
BR,
Suhas -
Function modules for data retrieval from diff. tables
Hi,
I would just like to ask if there are function modules that can be used to retrieve data from the ff. tables:
TSAD3T
KNVV
ESTRH
for TSAD3T i need to get the value of title_medi
for KNVV i need to get the fields klabc vkorg vtweg
for ESTRH i need to get the fields subcat subid.
Thanks.I doubt if you have such a FM
-
Module for data migration from pdf(zip) to pdf(unzip)
Hi all,
I am Working on Data migration using SAP XI with out using IR.
I want to Zip the pdf file in the Sender CC and unzip the same in Receiver CC.
I am using PAYLOADZIPBEAN to zip the pdf.
Did any one work on zipping and unzipping the PDF files?
Kindly let me know the Module I need to use for the same.
Thanks,
SreeHi Sree,
Please go through this blog and follow the step by step procedure for configuring your scenario.
/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
Its a nice blog and i have configured my scenario using the same already.
Thanks and Regards,
Sanjeev. -
Hello experts.
my requirement is , I am having a fiscial year ( gjahr) and period ie month (monart) . Now i need afunction module that gives the last date of the month. say if it is january it should give 31 - month-year. I want to populate this date to the budat field. so please tell me how to solve this issue. i want to pass as date-month-year to budat. but i am having year as seperate field and month as seperate field. so please tell me the function module that gives all the three or any other solution to this.
thanks for all the repliespopulate month, year u have and 01 into w_datum in and it should always give day1 of that month like this.
concatenate l_year l_month '01' into w_datum_in.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = w_datum_in
IMPORTING
last_day_of_month = w_datum_out
EXCEPTIONS
day_in_not_valid = 1
OTHERS = 2.
*reward if solved* -
Function Module for Date/ Time difference in Working Days
Hi all,
Are there any function modules which will calculate the difference between a date AND time, but in working days?
I can use the FIMA_DAYS_BETWEEN_TWO_DATES_2 FM for the dates, but I need to include times in this as well.
This is for situations where the 'starting date' is a non-working day, and the 'end date' is a working day. In this situation I need to take all the hours and minutes into account, which happened on the working day. To give an example -
Start date: 04.07.2010 (Sunday - Non working day)
Start time: 21:12:36
End date: 05.07.2010 (Monday - Working day)
End time: 04:47:24
I realise there is a Time option in this function module, but when I test it, it doesn't seem to be returning the desired results (returns 0 for days and time). I am using '5' as the I_STGMETH and 'GB' as the I_SKALID.
I need a calcuation which will return the time, post midnight on the working day - in this example, 4 hours, 47 minutes (seconds are optional!).
Can anyone help? - can I still use FIMA_DAYS_BETWEEN_TWO_DATES_2 but with different parameters?
Thanks
Mischa
Edited by: Mischa Gulseven on Jul 20, 2010 10:40 AMHi,
Thanks but this FM does not seem to account for working days.
For example, if I use:
DATE1 04.07.2010 (non working day)
TIME1 04:00:00
DATE2 05.07.2010 (working day)
TIME2 21:00:00
It will give the following results -
DATEDIFF 1
TIMEDIFF 17
EARLIEST 1
I don't want to account for the non-working day so the result I actually want would be to calculate from midnight on 05.07 to 21:00 on 05.07 which should be 21 hours.
I suspect I probably need to include the STGMETH and the factory calendar somewhere in the FM?
Does such a FM exist, or could anyone help me with some ABAP for this?
thanks
Mischa -
Function module for date ranges
Hi all,
Is there any function module to display all the dates in between start date and end date. Or provide blocke code for this.
Ex : If i have given nov 5th 2008 and nov 10th 2008 as input parameters.
Output should be nov 5th 2008, nov 6th 2008,nov 7th 2008,nov 8th 2008,nov 9th 2008,nov 10th 2008,
Please help me out in this regard.
thanks
naiduHi Omkaram,
Thank you verymuch for your code. That link is useful for me. I have rewarded you.
But when i'm using the same code in my function module its not working.
I have done the debugging the function module is not taking the input.
Ex : itab[] = lt_date[].
when i'm doing debugging the input parameter lt_date has no value.
I dont know why it is.
Can you help me please.
Regards
Naidu -
Function Module for DATE Conversion
Hi All,
I need some help to know a function module to get the exact date in a year.
If i give the no. of days and the year.. it has to give me the exact date.
for eg: if no. of days are 90 and the year is 2006 the output should be 31st MARCH 2006. Like that if i enter any number (< 364 or 363) and the year it has to tell me the date of the count of no.of days.
Thank You,
SureshHi Suresh,
You can use FM HR_SEN_CALE_DAYS_DATE.
Here you can pass '01.01.2006' , operator as '+' and in
IS_DURATION enter the number of days under 'CALDD'.
For eg:
Test for function group HRSEN00CRULE_CALE_DAYS
Function module HR_SEN_CALE_DAYS_DATE
Import parameters
ID_DATE 01.01.2006
ID_OPERATOR +
IS_DURATION 0.0000 0.0000 30.0000
Export parameters Value
ED_DATE 30.01.2006
Regards,
Raj -
Function Module for Date Conversion - 20060131 - January 31, 2006
I can write some quick code and use the T015M table, but I figure there must be an existing function module. I want to convert a system date to a character string. Ideally, I would like it based on a country field.
20060131 -> January 31, 2006
20060131 -> 31 January 2006Norman
Strange I've used edit mask LDATE, function CONVERSION_EXIT_LDATE_OUTPUT, and get the full month name.
Anyway, here is a little program to see the outputs for different countries. It does need updating for edit mask MODAT, and checking the return code after select and function calls:
REPORT ZZMATTG004 .
DATA: D8(20),
WA_MASK LIKE DD01D-CONVEXIT,
MONTH_NAMES LIKE T247 OCCURS 12 WITH HEADER LINE.
TABLES: T005. "Countries
PARAMETERS: DATE LIKE SY-DATUM DEFAULT SY-DATLO.
SELECT-OPTIONS S_LAND FOR T005-LAND1 NO INTERVALS.
PARAMETERS: P_LANGU AS CHECKBOX DEFAULT 'X'.
D8 = DATE.
DESCRIBE FIELD DATE EDIT MASK WA_MASK.
WRITE: 'MASK IS :- ''', WA_MASK NO-GAP, '''' NO-GAP.
SKIP.
WRITE:
/ DATE DD/MM/YYYY, 22 'DD/MM/YYYY',
/ DATE MM/DD/YYYY, 22 'MM/DD/YYYY',
/ DATE DD/MM/YY , 22 'DD/MM/YY',
/ DATE MM/DD/YY , 22 'MM/DD/YY',
/ DATE DDMMYY , 22 'DDMMYY',
/ DATE MMDDYY , 22 'MMDDYY',
/ DATE YYMMDD , 22 'YYMMDD'.
SKIP.
WRITE:
/ D8 USING EDIT MASK '==LDATE', 'LDATE',
/ D8 USING EDIT MASK '==SDATE', 'SDATE',
/ D8 USING EDIT MASK '==IDATE', 'IDATE',
/ D8 USING EDIT MASK '==D3DAT', 'D3DAT',
/ D8 USING EDIT MASK '==PDATE', 'PDATE',
/ D8 USING EDIT MASK '==INVD1', 'INVD1',
/ D8 USING EDIT MASK '==INVDT', 'INVDT'.
LOOP AT S_LAND.
* BREAK-POINT.
SET COUNTRY S_LAND-LOW.
SELECT SINGLE SPRAS INTO T005-SPRAS FROM T005
WHERE LAND1 = S_LAND-LOW.
IF P_LANGU = 'X'.
SET LANGUAGE T005-SPRAS.
ENDIF.
REFRESH MONTH_NAMES.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = T005-SPRAS
* IMPORTING
* RETURN_CODE =
TABLES
MONTH_NAMES = MONTH_NAMES
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 MONTH_NAMES INDEX DATE+4(2).
READ TABLE MONTH_NAMES WITH KEY MNR = DATE+4(2).
SKIP.
WRITE: / 'COUNTRY SET TO', S_LAND-LOW COLOR 2,
/ 'Month name is', MONTH_NAMES-KTX, MONTH_NAMES-LTX,
'Language (T005) is', T005-SPRAS, '(SYST)', SY-LANGU.
WRITE:
/ DATE DD/MM/YYYY, 22 'DD/MM/YYYY',
/ DATE MM/DD/YYYY, 22 'MM/DD/YYYY',
/ DATE DD/MM/YY , 22 'DD/MM/YY',
/ DATE MM/DD/YY , 22 'MM/DD/YY',
/ DATE DDMMYY , 22 'DDMMYY',
/ DATE MMDDYY , 22 'MMDDYY',
/ DATE YYMMDD , 22 'YYMMDD'.
SKIP.
WRITE:
/ D8 USING EDIT MASK '==LDATE', 'LDATE',
/ D8 USING EDIT MASK '==SDATE', 'SDATE',
/ D8 USING EDIT MASK '==IDATE', 'IDATE',
/ D8 USING EDIT MASK '==D3DAT', 'D3DAT',
/ D8 USING EDIT MASK '==PDATE', 'PDATE',
/ D8 USING EDIT MASK '==INVD1', 'INVD1',
/ D8 USING EDIT MASK '==INVDT', 'INVDT'.
ENDLOOP.
SET COUNTRY SPACE.
* SET LANGUAGE T005-SPRAS.
REFRESH MONTH_NAMES.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
* IMPORTING
* RETURN_CODE =
TABLES
MONTH_NAMES = MONTH_NAMES
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 MONTH_NAMES INDEX DATE+4(2).
READ TABLE MONTH_NAMES WITH KEY MNR = DATE+4(2).
SKIP.
WRITE: / 'COUNTRY SET TO', 'SPACE' COLOR 2,
/ 'Month name is', MONTH_NAMES-KTX, MONTH_NAMES-LTX.
WRITE:
/ DATE DD/MM/YYYY, 22 'DD/MM/YYYY',
/ DATE MM/DD/YYYY, 22 'MM/DD/YYYY',
/ DATE DD/MM/YY , 22 'DD/MM/YY',
/ DATE MM/DD/YY , 22 'MM/DD/YY',
/ DATE DDMMYY , 22 'DDMMYY',
/ DATE MMDDYY , 22 'MMDDYY',
/ DATE YYMMDD , 22 'YYMMDD'.
SKIP.
WRITE:
/ D8 USING EDIT MASK '==LDATE', 'LDATE',
/ D8 USING EDIT MASK '==SDATE', 'SDATE',
/ D8 USING EDIT MASK '==IDATE', 'IDATE',
/ D8 USING EDIT MASK '==D3DAT', 'D3DAT',
/ D8 USING EDIT MASK '==PDATE', 'PDATE',
/ D8 USING EDIT MASK '==INVD1', 'INVD1',
/ D8 USING EDIT MASK '==INVDT', 'INVDT'.
MattG. -
Convention for date diffs?
I run into this problem again and again with date functions
that use Now(). In this case, I just want to compare today's actual
date with another date, and determine the numbers of days
difference, not counting the time of day. But if I use
datediff(Now(), 'May 25, 2006'), it returns 0, because there isn't
a full day's difference between May 24, 2006 12:30 PM and May 25,
2006 12:00 AM (May 25 being tomorrow). What I want to see is "1".
I've always used Now()-1 to compensate for this, but that
doesn't seem very elegant. Is there a simply way to code "return
the difference between today's date and another date, without the
time of day being factored in?"JMGibson3 wrote:
> How bout simply dropping time out of the equation
altogether(my session var was already date only):
>
> <cfif
DateDiff("d",DateFormat(Now(),"MM/DD/YYYY"),Session.SelThruDate) GT
7>
or you could use cf epoch offset (days since 31-dec-1899):
<cfif int(Session.SelThruDate) - int(now()) GT 7>
Maybe you are looking for
-
I switched to Verizon in March 2014, from AT&T. I traded in my old iPhone4 for a Galaxy 4. Ever since, I am not getting text messages from anyone who has an iPhone unless they WORK for Verizon. I have deleted my phone from my apple profile and I d
-
Dear Gurus, Good Afternoon!! My user' requirement is, he wants a BOM wise stock report. He will just enter the Header Item, Plant and the storage location, and system should list all its sub-items with the stock available in that plant & the storage
-
Recently purchased Adobe Acrobat 9 Pro Extended.
I was using 8 and was having issues with LifeCycle. Now that I have loaded the new version with the LifeCycle Designer ES 8.2 that came with the upgrade crashes when I try to upload a form to continue work. I have gone through the process of deleting
-
Select wioth extract() gives error
Hello, am a bigginer! SQL> select proceedings.papers.extract('/paper/title/text()').getStringVal() from proceedings; select proceedings.papers.extract('/paper/title/text()').getStringVal() from proceedings ERROR at line 1: ORA-00904: invalid column n
-
Why can i watch videos online just the audio?
on youtube the regular screen pops up to play the video but non of the options like volume or stuff show up just a blank black square, the same thing happens with any other video on any website the only thing that plays is the audio and im trying t