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

find the date needed

Former Member
0 Likes
1,558

Hello All,

I have a reqmnt,

I want to find out the dates of current academic year using sy-datum, it means if i provide date 06/07/07, the dates i need in return is 31-07-07 and 01-08-06. could anyone suggest how do i go bout it.

thanks,

RS

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,536

HI,

you can get last day of the month using "FM LAST_DAY_OF_MONTHS"

Pass your date current date and you get l;ast day of the month from this fumction module..

I clearly did not understand your requirement can you be please more clear

rewards if useful,

regards,

nazeer

Hello All,

I have a reqmnt,

I want to find out the dates of current academic year using sy-datum, it means if i provide date 06/07/07, the dates i need in return is 31-07-07 and 01-08-06. could anyone suggest how do i go bout it.

thanks,

RS

10 REPLIES 10
Read only

S-H
Product and Topic Expert
Product and Topic Expert
0 Likes
1,536

Hi Reena,

If you want to find out the dates are in current year or not, then use the split statement and store the year part in a variable and compare with the current year.

Best regards,

Suresh

Read only

Former Member
0 Likes
1,536

Hi Reena,

l_date type sy-datum,

l_date1 type sy-datum,

l_date2 type sy-datum.

l_year(4) type n

l_month(2) type n

pass l_date to SG_PS_GET_LAST_DAY_OF_MONTH you get last day in l_date1.

now

l_year = l_date1(4) - 1.

l_month = l_date1+4(2) +1.

concatenate l_year l_month '01' to l_date2.

Reward points if useful.

Regards,

Atish

Message was edited by:

Atish Sarda

Read only

Former Member
0 Likes
1,536

Hi Reena,

Use FM LAST_DAY_OF_MONTHS, it will give you last date and add 1 to that date. It will give you both the dates

Means,

YOur date => FM => Last date (date1)

date2 = add 1 to last date

Reward if useful!

Read only

Former Member
0 Likes
1,536

Try this FM to get the last day of the given month....

JVA_LAST_DATE_OF_MONTH

Prabhu Rajesh

Read only

Former Member
0 Likes
1,537

HI,

you can get last day of the month using "FM LAST_DAY_OF_MONTHS"

Pass your date current date and you get l;ast day of the month from this fumction module..

I clearly did not understand your requirement can you be please more clear

rewards if useful,

regards,

nazeer

Read only

0 Likes
1,536

thanks all for yr replies, but i need to make myself more clear i guess,

i need academic year dates, which mean, if we have past august then academic year dates are 01-08 current year and 31-07 prev year and if have not past the july then its 01-08 of prev year and 31-07 of next year.

Read only

0 Likes
1,536

Hi reena,

Try based on the solutions given. You will get logic.

Regards,

Atish

Read only

Former Member
0 Likes
1,536

Hi Reena,

can you try combining the FM RS_VARI_V_1_NEXT_MONTH returns the next months starting date. and the FM LAST_DAY_OF_MONTHS gives the last day.

<b>Reward pts if found usefull.</b>

Regards

Sathish

Read only

Former Member
0 Likes
1,536

DATA:

FROM_DATE LIKE SY-DATUM,

TO_DATE LIKE SY-DATUM,

W_YEAR(4).

parameters:

p_date like sy-datum.

if p_date+4(2) LE '07'.

W_YEAR = P_DATE+0(4).

W_YEAR = W_YEAR - 1.

CONCATENATE W_YEAR '0801' INTO FROM_DATE.

ELSE.

CONCATENATE P_DATE+0(4) '0801' INTO FROM_DATE.

ENDIF.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'

EXPORTING

MONTHS = 12

OLDDATE = FROM_DATE

IMPORTING

NEWDATE = TO_DATE .

TO_DATE = TO_DATE - 1.

WRITE:/ P_DATE,FROM_DATE,TO_DATE.

Read only

Former Member
0 Likes
1,536

I think the solution i gave, is what you asked for, right? If yes then don't forget to reward points