‎2008 Aug 12 5:16 AM
Hi Experts,
In my report, I am using mcs0-spmon as select options; one of my inputs where the user will enter month and year in the selection screen . e.g. 04.2008 to 07.2008
I want to calculate the month difference and it should not exceed 3 months. If it does, an error will be shown.
My question is -
Is there any Function Module by which I can proceed. How do I go about it?
Can anyone tell me a solution?
Thanks in advance
‎2008 Aug 12 5:32 AM
Hi,
concatenate '200804' '01' into dur_begda.
concatenate '200807' '01' into dur_endda.
call function 'HR_PT_GET_MONTHS'
exporting
first_date = dur_begda
second_date = dur_endda
modify_interval = space
importing
duration = duration-months
exceptions
invalid_seq_dates = 1.
Thanks,
Durai.V
Edited by: Durai V on Aug 12, 2008 6:33 AM
‎2008 Aug 12 5:29 AM
Hi,
Here is the piece of code....
what u can do is just supply the date from u which u want to subtract and value for subtraction u give 3 then u check the new date if it is equal to the date u have second its ok u can proceed else u give error message...
i hope u will get ur solution...
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = - 3 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date.
‎2008 Aug 12 5:33 AM
Hey I already know about this FM. I am using select-options. I know it's a bit weird, but after all it's a client requirement. He want From-To option in the selection-screen
‎2008 Aug 12 5:32 AM
Hi,
concatenate '200804' '01' into dur_begda.
concatenate '200807' '01' into dur_endda.
call function 'HR_PT_GET_MONTHS'
exporting
first_date = dur_begda
second_date = dur_endda
modify_interval = space
importing
duration = duration-months
exceptions
invalid_seq_dates = 1.
Thanks,
Durai.V
Edited by: Durai V on Aug 12, 2008 6:33 AM
‎2008 Aug 12 6:00 AM
‎2008 Aug 12 5:40 AM