‎2008 Jul 23 7:45 AM
Hi Friends,
Here is my query, i need to get the date for past 6 months.
Ex : suppose if i have date 23.07.2008 i need to get the date 23.01.2008 as output can u suggest me where i comitted a mistake for below code as it is throughing short dump.
data : v_date type datum,
l_date type datum,
v_durmm type PSEN_DURATION-durmm value 6.
move sy-datum to v_date.
CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'
EXPORTING
IM_DATE = v_date
IM_OPERATOR = '-'
IM_DURATION = v_durmm
IMPORTING
EX_DATE = l_date.
write l_date.
thnks in advance.
Regards,
poorna.
‎2008 Jul 23 7:50 AM
‎2008 Jul 23 7:53 AM
Hi Chandrika,
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
The call to the function module "HR_99S_DATE_ADD_SUB_DURATION" is incorrect:
The function module interface allows you to specify only
fields of a particular type under "IM_DURATION".
The field "V_DURMM" specified here is a different
field type
.
‎2008 Jul 23 7:51 AM
Hi,
Step 1: take the date like Sy-datum in declaration.
Step 2: tkae the month by setting the offset 4(2) to the date.
Step 3: subtruct 6 from it.
You will get the result.
Check the code:
parameters:
p_date type sy-datum.
data:
temp_month type i.
temp_month = p_date+4(2) - 6.
p_date+4(2) = temp_month.
write:p_date.change accordingly in your FM code
Regards,
anirban
‎2008 Jul 23 8:09 AM
Hi friend,
if i have month FEB then this logic will not be applicable, i am right? date calcuation should be done dynamically as per the current date.
ex. if i run the report for every week and fetching the records for the past 6 months as of run date.
thanks,
poorna
‎2008 Jul 23 8:05 AM
Hi purna
Do coding like this
data : v_date type datum,
l_date type datum,
v_durmm type PSEN_DURATION.
v_durmm-durmm = 6.
move sy-datum to v_date.
CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'
EXPORTING
IM_DATE = v_date
IM_OPERATOR = '-'
IM_DURATION = v_durmm
IMPORTING
EX_DATE = l_date.
write l_date.HOPE THIS HELPS U
Thanks and regards
Tamilselvan.K
‎2008 Jul 23 8:10 AM
Hi friend,
I have done the same thing thank you very much.
dont boughter you will get the points.
regards,
poorna
‎2008 Jul 23 8:14 AM
Hi,
Check this,
REPORT ZSCD_TEST10.
data : v_date type datum,
l_date type datum,
v_durmm type PSEN_DURATION.
v_durmm-DURMM = '6'.
v_date = sy-datum.
CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'
EXPORTING
IM_DATE = v_date
IM_OPERATOR = '-'
IM_DURATION = v_durmm
IMPORTING
EX_DATE = l_date.
write l_date.
Pranu
‎2008 Jul 23 8:40 AM
Hi Purna,
data : v_date type datum,
l_date type datum,
v_durmm type PSEN_DURATION-durmm value 6.
move sy-datum to v_date.
CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'
EXPORTING
IM_DATE = v_date
IM_OPERATOR = '-'
IM_DURATION = v_durmm
IMPORTING
EX_DATE = l_date.
write l_date.
u double click on function 'HR_99S_DATE_ADD_SUB_DURATION' and then click the tab exporting & importing to see what is the type of IM_DATE and EX_DATE and then u declare v_date and I_date of the same type ...
i hope this will help u..
Thanks & Regards
Ashu Singh.