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 next month

Former Member
0 Likes
11,105

Hi,

Can you give the function module name for follwoing requirement.

If we give the date then it should return next month first date.

ex

input output

01/01/2008 01/02/2008

05/11/2007 01/12/2007

01/12/2007 01/01/2008

Rewards as per ur input.

Regards,

Y kiran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,655

hi kiran,

you can use :

RP_CALC_DATE_IN_INTERVAL : Add days / months to a date

plz reward if useful..

9 REPLIES 9
Read only

Former Member
0 Likes
4,656

hi kiran,

you can use :

RP_CALC_DATE_IN_INTERVAL : Add days / months to a date

plz reward if useful..

Read only

Former Member
0 Likes
4,655

Hi

First use FM OIL_MONTH_GET_FIRST_LAST

Import parameters Value

I_DATE 10/10/2007

Export parameters Value

E_DATE 11/10/2007

Then pass this value to OIL_MONTH_GET_FIRST_LAST

Import parameters Value

I_MONTH 00

I_YEAR

I_DATE 10/10/2007

Export parameters Value

E_FIRST_DAY 10/01/2007

E_LAST_DAY 10/31/2007

Regards

Shiva

Read only

JozsefSzikszai
Active Contributor
0 Likes
4,655

hi Kiran,

I am not sure, if FM exists but you can use the following logic:

DATA: L_DATE LIKE SY-DATUM.

DATA: L_YEAR TYPE I.

DATA: L_MONTH TYPE I.

MOVE '01' TO L_DATE+6(2).

MOVE L_DATE(4) TO L_YEAR.

MOVE L_DATE+4(2) TO L_MONTH.

L_MONTH = L_MONTH + 1.

IF L_MONTH GT 12.

L_YEAR = L_YEAR + 1.

L_MONTH = 1.

ENDIF.

MOVE L_YEAR TO L_DATE(4).

MOVE L_MONTH TO L_DATE+4(2).

l_date should be your input.

hope this helps

ec

Read only

varma_narayana
Active Contributor
0 Likes
4,655

Hi..

First Call the FM

RP_LAST_DAY_OF_MONTHS : To Determine last day of month

Then Add 1 to the Date. It will give the First day of Next month.

<b>reward if Helpful.</b>

Read only

Former Member
0 Likes
4,655

Hi Kiran,

Try This FM.

CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'

EXPORTING

months = 1

olddate = ws_startdate (01.02.2007)

IMPORTING

NEWDATE = ws_date. (01.03.2007)

or use the fm

CALL FUNCTION 'HR_JP_ADD_MONTH_TO_DATE'

EXPORTING

iv_monthcount = ws_01

iv_date = lws_date (01.02.2007)

IMPORTING

ev_date = lws_date.(01.03.2007

Reward If Useful.

Regards,

Chitra

Read only

Former Member
0 Likes
4,655

Hi,

Use the function module LAST_DAY_OF_MONTHS

then Add 1 to the return parameter.

Reward if helpful.

Regards,

Harini.S

Read only

Former Member
0 Likes
4,655

Hi,

Use the FM:

MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.

Example:

data: new_date type d.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'

EXPORTING

months = 1 " Negative to subtract from old date, positive to add

olddate = sy-datum

IMPORTING

NEWDATE = new_date.

write: / new_date + 1.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
4,655

hi,

use code as below : <b>test Just copy and paste</b>

data : IV_DATE TYPE D,

EV_MONTH_BEGIN_DATE TYPE D,

EV_MONTH_END_DATE TYPE D,

next_month type BKPF-BLDAT.

iv_date = '20070101'.

CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

EXPORTING

iv_date = iv_date

IMPORTING

EV_MONTH_BEGIN_DATE = EV_MONTH_BEGIN_DATE

EV_MONTH_END_DATE = EV_MONTH_END_DATE

.

write : EV_MONTH_BEGIN_DATE.

CALL FUNCTION 'J_1H_CAL_DATE_IN_INTERVAL'

EXPORTING

date = EV_MONTH_BEGIN_DATE

days = 00

months = 01

SIGNUM = '+'

years = 00

IMPORTING

CALC_DATE = next_month

.

WRITE / next_month.

Regards,

sandeep kaushik

Read only

Former Member
0 Likes
4,655

Hi,

I think there is no Standard Fm ( not Sure ).

u can ise these two FM to get output

OIL_GET_NEXT_MONTH -


> gives Next month and pass this value to this FM

RE_BE_CALC_START_DATE ---> gives start date of the month.

Reward if useful.

Regards,

Vimal