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

Getting Last Month End date

Former Member
0 Likes
1,732

Dear Experts,

I want the following result. I have a date parameter. I want to

get the last / end date of the previous month

for any given date which the user inputs.

For ex:

If user puts the date 15.06.2008

then i want to get the previous month end date i.e. 31.05.2008.

The reason being i am creating a program for updating Opening and Closing Stocks of every month in a ZTABLE. The user will put the date in the parameter and system will bring the closing stock of previous month and then calculate for the current month.

I hope i am not complicating matters too much....

Basic funda is to arrive at the end date of the previous month for any date which the user puts.

Please help me... it is mission critical..

Thanks & Regards,

Jitesh M Nair

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,063

Hello,

You can use the following Function module to get the last day of the previous Month.

OIL_LAST_DAY_OF_PREVIOUS_MONTH

Regards

Arindam

Edited by: Arindam Ganguly on Nov 24, 2008 6:13 AM

6 REPLIES 6
Read only

GauthamV
Active Contributor
0 Likes
1,063

hi,

use this to get last month end date.


ex:
data: d2 like sy-datum.
d2 = sy-datum.
d2+6(2) = '01'.
d2 = d2 - 1. "prev mnth last date
write:/ d2.

Read only

Lakshmant1
Active Contributor
0 Likes
1,063

Hi,

Check FM RS_VARI_V_L_LAST_MONTH

Thanks

Lakshman

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,063

Search it in forum for more results...

Read only

Former Member
0 Likes
1,064

Hello,

You can use the following Function module to get the last day of the previous Month.

OIL_LAST_DAY_OF_PREVIOUS_MONTH

Regards

Arindam

Edited by: Arindam Ganguly on Nov 24, 2008 6:13 AM

Read only

Former Member
0 Likes
1,063

Hi,

There are lot of function module you can find it in se37 month and press f4 find the function module which coincides with your requirement...

Thanks,

Thiru. R

Read only

Former Member
0 Likes
1,063

Hi,

subtract 1 from the current months 1st date.

Thanks & Regards,

Sudheer