cancel
Showing results for 
Search instead for 
Did you mean: 

regarding dates.

Former Member
0 Kudos

hi gurus, i have some doubt regarding dates function.

if i enter any date of present month i wand the first date of next month.

for example if i enter any date in january from 01/01/2007 to 31/01/2007 i want

first date of february. ie 01/02/2007. plz help me.

regards

vamsi.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi chetan thanks for replying to my query and i want to know the logic without using functions plz reply soon.

regards

vamsi.

Former Member
0 Kudos
REPORT ZTEST.

PARAMETERS : P_DATE LIKE SY-DATUM DEFAULT '20070101'.

DATA : V_MONTH(2),
       V_YEAR(4),
       V_DATE(8),
       V_DATE1 LIKE SY-DATUM.

V_MONTH = P_DATE+4(2).
V_YEAR = P_DATE+0(4).

IF V_MONTH EQ '12'.
  V_MONTH = '01'.
  V_YEAR = V_YEAR + 1.
ELSE.
  V_MONTH = V_MONTH + 1.
ENDIF.

UNPACK V_MONTH TO V_MONTH.

CONCATENATE V_YEAR V_MONTH '01' INTO V_DATE.

WRITE : V_DATE TO V_DATE1.

WRITE : V_DATE1.

If helpful pls reward with points

Message was edited by:

Chandrasekhar Jagarlamudi

Former Member
0 Kudos

thanks chandrasekhar your solution is excellent

Former Member
0 Kudos

Hi,

This is a simple way to get your next month first date.

-


REPORT ZNEXTMONTH.

parameter dt type sy-datum.

data: newdate type sy-datum.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'

EXPORTING

MONTHS = 1

OLDDATE = dt

IMPORTING

NEWDATE = newdate .

newdate+6(2) ='01'.

write newdate.

-


Hope, this will solve ur problem.

Thanks,

Chetan Shah

Former Member
0 Kudos

thanks priyanka for reply regarding dates

regards

vamsi.

Former Member
0 Kudos

Hi

use this coding

data : d1 type sy-datum,

d2 type sy-datum,

d3 type sy-datum,

d4(8),

m(2),

y(4).

d1 = sy-datum.

CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'

EXPORTING

I_DATE = d1

IMPORTING

E_DATE = d2 .

write : d1.

skip 3.

m = d2+4(2).

y = d2+0(4).

concatenate y m '01' into d4 .

d3 = d4.

write : / d3.

write : / d2.

write / '***********2 month****************************'.

d3 = d2 + 1.

CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'

EXPORTING

I_DATE = d3

IMPORTING

E_DATE = d2 .

write 😕 d3,

/ d2.

write / '**************3 month ***************************'.

d3 = d2 + 1.

CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'

EXPORTING

I_DATE = d3

IMPORTING

E_DATE = d2 .

write 😕 d3,

/ d2.

Former Member
0 Kudos

"regarding dates."