Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module for preveous month date calculation date calculation

Former Member
0 Likes
1,516

Hi All,

Is there any Function module to convert 1st date of current month to last date of preveous month.

becouse my date is coming like ' 79949668' I have convert it into 01.04.2005 with the help of FM

CONVERSION_EXIT_INVDT_OUTPUT.Ok now I want last date of preveous month so I tried minus one option but it is not working.

Please help.

Regards,

Tushar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,082

Hi,

The actual date is 99999999 - 79949668 = 20050331. Move this value to sy-datum variable format and do the minus operation, that would give the date value you are looking for.

Issa

6 REPLIES 6
Read only

Former Member
0 Likes
1,082

By example if you have a variable

data L_date like sy-datum.

with 20090101 and you want the day before make this

l_date = l_date - 1.

Now you have 20081231

Read only

Former Member
0 Likes
1,082

dear

this is the Fuction module solve your problem :

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
  EXPORTING
    date            =  02.02.2009
    days            =
    months          = 1
*   SIGNUM          = '+'
    years           = 
* IMPORTING
*   CALC_DATE       =   02.03.2009  

rgds ankit

Read only

Former Member
0 Likes
1,082

hi,

you can also do it this way... it will work for sure....

date = date - 31.

Regards,

Siddarth

Read only

Former Member
0 Likes
1,083

Hi,

The actual date is 99999999 - 79949668 = 20050331. Move this value to sy-datum variable format and do the minus operation, that would give the date value you are looking for.

Issa

Read only

0 Likes
1,082

Hi,

Try with the following Function Modules.

OIL_LAST_DAY_OF_MONTH - Gives the last day of the month

SG_PS_GET_LAST_DAY_OF_MONTH - Last day of the month

OIL_LAST_DAY_OF_PREVIOUS_MONTH - Gives the last day of the prevous month

OIL_MONTH_GET_FIRST_LAST - Gives the month first day date & last day date

Thank you,

Sekhar.

Read only

Former Member
0 Likes
1,082

Hi Tushar,

try this FM "HR_PT_ADD_MONTH_TO_DATE "


HR_PT_ADD_MONTH_TO_DATE 	"HR-PT: Add or subtract months to a ', '-' or '='. if '=', then
u2022	DMM_POS = 'BEG' - return 1st day of the DMM_COUNT month of the same year. Use MM format (e.g. 02) otherwise you can get date like '2 /12/2002' for February uF04C. 
u2022	DMM_POS = 'END' - returns the (DMM_COUNT month + 1), (day - 1) for the input date DMM_DATIN.
Bug: try DMM_DATIN = MM/31/YYYY, DMM_COUNT = 1 uF04C. 


RS_VARI_V_L_LAST_MONTH 	Returns last day of last month. 

RS_VARI_V_1_ACTUAL_MONTH Returns first day of the actual Month
RS_VARI_V_1_LAST_MONTH    Returns first day of the Last MOnth
RS_VARI_V_1_NEXT_MONTH 	 Returns first day of the next month. 


Regardss,

Prabhu