‎2008 Aug 22 5:02 AM
Hi ALL,
My Requirement as Follows,
I Have developed a Function Module with
'FROM Date'
'To Date. as Import Paramter,
The thing is , i need to Initialize these values .
TO Date as Sy-datum & FROm Date as 3 months back from todays date.
These should be displayed as soon as the Import parameter appear when we execute fm i,e before output.
please help me out .
Note:
To date : I hvae initialized by passing sy-datum in default parameter. but From date - i am unable to get.
‎2008 Aug 22 5:20 AM
Hi Dude,
Use this Function Module(RKE_CONVERT_DATE_TO_PERIOD) to get the previous 3rd month date.
Pass the parametrs as
Import parameters Value
DATE 22.08.2008 "sy-datum
PERFLAG 1
PERIV V3
Then U will Get the Outputput as
PERIO 005.2008
U will get the Month and the year, Now u Use
sy-datum+0(2) u will get the date i.e 22.
PERIO+1(7) u will get 05.2008
now concatenate 22 and 05.2008 separated by '.'.
Hope this helps u.
‎2008 Aug 22 5:20 AM
Hi Dude,
Use this Function Module(RKE_CONVERT_DATE_TO_PERIOD) to get the previous 3rd month date.
Pass the parametrs as
Import parameters Value
DATE 22.08.2008 "sy-datum
PERFLAG 1
PERIV V3
Then U will Get the Outputput as
PERIO 005.2008
U will get the Month and the year, Now u Use
sy-datum+0(2) u will get the date i.e 22.
PERIO+1(7) u will get 05.2008
now concatenate 22 and 05.2008 separated by '.'.
Hope this helps u.
‎2008 Aug 22 6:28 AM
Thanks RAM,
But i have used fm to calculate the Date my main Problem is i am Unable to pass that Value to the Import parameter:
That is from se37 if we execute the FM u will get the Import Parameters at that time this date also should come, But it's not comming .
Thanks in advance.
‎2008 Aug 22 7:08 AM
Hi Dude,
Click on the Source Code Tab
and Write the Code.
This code should contain i_param = v_Date.
where i_param is Ur import parameter name.
v_Date is Ur calculated Date.
Keep break-point and execute.
‎2008 Aug 22 7:47 AM
>
>
> But i have used fm to calculate the Date my main Problem is i am Unable to pass that Value to the Import parameter:
>
> That is from se37 if we execute the FM u will get the Import Parameters at that time this date also should come, But it's not comming .
>
Hi Nagaraju,
If this is the case i can suggest you a way to do this....
Make the import parameters(TO and From Dates) as optional..
And Inside the function module check if the import parameters are initial, if the values are not supplied, generate it yourself using the code i gave above....
If u want to supply value from a program, use the above code in the program and supply the To and From date in the function call.
So now if u go to SE37 and execute it without supplying values, it will get calculated inside the Function Module itself, in case u supply it will take it for calculation.
Hope this will work well for your requirement.
Regards
Karthik D
‎2008 Aug 22 7:26 AM
Hi,
Use the Following FM....
MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
Example:
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.Regards
Karthik D