10-09-2008 1:03 PM
hi Buddies.....
the problem is there is no output... It shows 0 (zero) in output... Please help me to solve this problem...
thanks,
anand. S
10-09-2008 1:05 PM
Would be nice if we knew what you were doing.
But since your problem description is so vague, i'll give you a vague answer: 42.
10-09-2008 1:08 PM
Hi dude,
Don directly subtract two dates.
Goto SE37,
Press F4.
In the information system, under SHORT DESCRIPTION, search as follows.
DateCalculation*
or
DateTwo*.
You will find some function module to do this.
10-09-2008 1:09 PM
10-09-2008 1:12 PM
Hi Anand,
Use this Function Module
SD_DATETIME_DIFFERENCE
regards,
Peter
10-09-2008 1:30 PM
10-09-2008 1:33 PM
10-09-2008 1:35 PM
call function 'HR_HK_DIFF_BT_2_DATES'
exporting
date1 = '19950630'
date2 = '19950101'
OUTPUT_FORMAT = '01'
*IMPORTING
YEARS =
months = mon
DAYS =
EXCEPTIONS
INVALID_DATES_SPECIFIED = 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.
This is my input.. But there is no output.
10-09-2008 1:40 PM
as it was told already (by Maen), there is no reason to use FM for calculating the difference between two dates. simply:
DATA : diff TYPE i.
diff = date1 - date2.
(where both dates are TYPE datum)
10-09-2008 1:41 PM
hi..
try giving date1 as '19950101'
date2 = '19950630'
regards,
Padma
10-09-2008 1:42 PM
Oh boy....
Remove the comment mark before IMPORTING and DAYS
And assign a variable to DAYS.
Edited by: Maen Anachronos on Oct 9, 2008 2:42 PM
10-09-2008 2:35 PM
>
> Could you send me the exact coding ...?
Can you send me the exact dates...?
10-09-2008 2:49 PM
call function 'HR_HK_DIFF_BT_2_DATES'
exporting
date1 = '19950630'
date2 = '19950101'
OUTPUT_FORMAT = '01'
*IMPORTING
YEARS =
months = mon
DAYS =
EXCEPTIONS
INVALID_DATES_SPECIFIED = 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.
This is my input.. But there is no output.
10-09-2008 2:53 PM
My last try on this one...
How do you suppose to get a value BACK from the function module if you don't supply a variable to the IMPORTING part?
IMPORTING
MONTHS = mon
instead of (see the difference?)
* IMPORTING
* MONTHS = mon
or even
IMPORTING
DAYS = day
And what do you need to calculate? The differnce in DAYS? MONTHS?
Edited by: Maen Anachronos on Oct 9, 2008 3:54 PM
10-09-2008 2:56 PM
Hi,
Please first tell us in what format do you want your output. If it is the number of days alone then you can directly do a date1 - date2.
If you require in Years months days only then you need to use this FM and here is the coding.
data : w_year type <data_type_in_FM>,
w_mon type <data_type_in_FM>,
w_days type <data_type_in_FM>.
call function 'HR_HK_DIFF_BT_2_DATES'
exporting
date1 = '19950630'
date2 = '19950101'
IMPORTING
YEARS = w_year
months = w_mon
DAYS = w_days
EXCEPTIONS
INVALID_DATES_SPECIFIED = 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.
Regards,
Pramod
10-09-2008 3:00 PM
I don't think a program is needed for this. It is clear as daylight that the answer is 6 months.
10-09-2008 3:02 PM
6 months: the time it will take to have OP understand all answers?
/sigh
10-10-2008 5:13 AM
10-10-2008 8:37 AM
10-10-2008 8:40 AM
10-09-2008 6:23 PM
I prefer to have a multiple calendar table layout and perform a simple recursive searches and calculations from there..
One for each of: Julian, Gregorian, Mixed-Style Date, Dominical Letter suffix, a separate Holiday calendar table for each country and religion. and of course, let's not forget integrating in with the active Factory calenders in your SAP-instance.
I can send all the code, but I'll need an external address that can handle file attachments larger then 2.5gig.
10-10-2008 9:13 AM
>
> I prefer to have a multiple calendar table layout and perform a simple recursive searches and calculations from there..
> One for each of: Julian, Gregorian, Mixed-Style Date, Dominical Letter suffix, a separate Holiday calendar table for each country and religion. and of course, let's not forget integrating in with the active Factory calenders in your SAP-instance.
>
> I can send all the code, but I'll need an external address that can handle file attachments larger then 2.5gig.
My FTP server can handle that! I'll set up an accoutn but only if you include the Mayan calendar as well.
10-11-2008 4:50 PM