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

Date Issue

Former Member
0 Likes
952

Hi Experts,

I am having current date (26.12.2006). Based on current date i required next month first date (01.01.2007) and march month last date (31.03.2007).

Regards,

Rajneesh Gupta

10 REPLIES 10
Read only

Former Member
0 Likes
921

Try any FM for getting the fiscal year dates (March end date)...

and for Next month first date...see..

<b>

HR_SGPBS_ADD_TIME_TO_DATE</b> Find the next date based on input date , addition / sub and month , year ,date

Refer this link for more on DATE FMs...

<a href="http://www.geocities.com/victorav15/sapr3/abapfun.html#date">Date FMs in SAP</a>

Regards,

Raj

Message was edited by:

Rajasekhar Dinavahi

Read only

Former Member
0 Likes
921

HI,

You can easily capture the month of the current data.so use the offset and capture the month, if the month is 12 then use the next month first data as you writen in your question.

so normally, the starting date is is 1st, to know the last day of the month, use the fucntion module <b>RP_LAST_DAY_OF_MONTHS</b>

Regards

Sudheer

Read only

Former Member
0 Likes
921

u can make the code work like this.

data: date like sy-datum,
      date1 like sy-datum.

date = sy-datum.

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
  EXPORTING
    day_in                  = date
 IMPORTING
   LAST_DAY_OF_MONTH       = date1
 EXCEPTIONS
   DAY_IN_NO_DATE          = 1
   OTHERS                  = 2
          .

add 1 to date1.

write:/ 'next month start date:', date1.


*to fetch the march month last date.
date1+4(2) = 03.

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
  EXPORTING
    day_in                  = date1
 IMPORTING
   LAST_DAY_OF_MONTH       = date1
 EXCEPTIONS
   DAY_IN_NO_DATE          = 1
   OTHERS                  = 2
          .

write:/ 'last date of march:', date1.

Please close your previous threads.

regards,

vijay

Read only

0 Likes
921

It's working perfectly.

Thanks.

Read only

0 Likes
921

Glad that this is working perfectly.. infact it should ... )

regards,

vijay

Read only

Former Member
0 Likes
921

Hi,

Hope the following code will helps to you.

lv_date = '20061226'.

* Next month first date.
lv_date+4(2) = lv_date+4(2) + 1.
lv_date+6(2) = '01'

* For getting march mont  month last date (lv_emonth)
  concatenate lv_date+0(1) '01' '01' into lv_date1.
CALL FUNCTION 'REAL_ESTATE_CALC_DATE_SLST'
 EXPORTING
   I_DATE                               = lv_date1
   ID_MONTH_OFFSET           = 1
 IMPORTING
   E_DATE_MONTH_END       = lv_emonth
 EXCEPTIONS
   ERROR                  = 1
   OTHERS                 = 2.
          
IF sy-subrc <> 0.
Message 'Error' type 'E'.
endif.

Regards

Bhupal Reddy

Read only

Former Member
0 Likes
921

data: date like sy-datum,

date1 like sy-datum.

date = sy-datum.

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'

EXPORTING

day_in = date

IMPORTING

LAST_DAY_OF_MONTH = date1

EXCEPTIONS

DAY_IN_NO_DATE = 1

OTHERS = 2

add 1 to date1.

write:/ 'next month start date:', date1.

*to fetch the march month last date.

date1+4(2) = 03.

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'

EXPORTING

day_in = date1

IMPORTING

LAST_DAY_OF_MONTH = date1

EXCEPTIONS

DAY_IN_NO_DATE = 1

OTHERS = 2

write:/ 'last date of march:', date1.

Read only

0 Likes
921

Whats up mike ?

))

Read only

Former Member
0 Likes
921

data:

w_v1 like sy-datum.

w_v1 = sy-datum.

w_v1 = w_v1 + 65.

w_v1+6(2) = 01.

write:/ w_v1.

w_v1 = w_v1 - 1.

w_v1+6(2) = 01.

w_v1 = w_v1 - 1.

w_v1+6(2) = 01.

write:/ w_v1.

not exactly the same you need but

use this concept w_v1 = w_v1 + 65. &w_v1+6(2) = 01.

you will get your requirement

Regards,

Phani

Read only

Former Member
0 Likes
921

It's working perfectly.

Thanks.