Application Development 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: 

date to furure monts

Former Member
0 Kudos

hi

my req.ment is if i enter the date i have to diplay the three future months

example : input 25/06/2008

my output should be july

August

September

so is there any fm, or sample program. which is rewardful.

thx

sat

8 REPLIES 8

Former Member
0 Kudos

Hi,

You can use MONTH_NAMES_GET.

You may need some coding to get the long text for the month names.

Regards,

Subramanian

Former Member
0 Kudos

You make use of FM IDWT_READ_MONTH_TEXT with some logic.

former_member188685
Active Contributor
0 Kudos

Check the sample code..

REPORT  z_sdn.
data: text type T247-LTX.

PARAMETERS p_date type sy-datum.

do 3 times.
 p_date+4(2) =  p_date+4(2) + 1.
 CALL FUNCTION 'ISP_GET_MONTH_NAME'
   EXPORTING
     DATE               = p_date
     language           = sy-langu
  IMPORTING
    LONGTEXT           =  TEXT
  EXCEPTIONS
    CALENDAR_ID        = 1
    DATE_ERROR         = 2
    NOT_FOUND          = 3
    WRONG_INPUT        = 4
           .
  write text.

enddo.

Former Member
0 Kudos

hi,

using FM MONTH_NAMES_GET you will get month names and corresponding numbers. you can build the logic to get next three months.

Reward if find useful

Former Member
0 Kudos

hi,

pick the month value by using offset.

month = date+3(2).

This will give you the month. Pass that value in a select statement and print the necessary output. PLz Take necessary care for Nov And Dec.

Reward if Helpful.

Sumit Agarwal

Former Member
0 Kudos


data: itab like t247 occurs 0 with header line.

parameters: date like sy-datum.

CALL FUNCTION 'MONTH_NAMES_GET'
 EXPORTING
   LANGUAGE                    = SY-LANGU
* IMPORTING
*   RETURN_CODE                 =
  TABLES
    month_names                 = itab
* EXCEPTIONS
*   MONTH_NAMES_NOT_FOUND       = 1
*   OTHERS                      = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at itab.
if date+4(2) = itab-mnr.
write:/  itab-ltx.
endif.
endloop.

Former Member
0 Kudos

Hi,

Use the following function module.

Please check FM RP_CALC_DATE_IN_INTERVAL.

data: wa_date like sy-datum.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = sy-datum

days = 0

months = 3

signum = '+'

years = 0

importing

calc_date = wa_date.

write: / wa_date.

Regards,

Raj.

Former Member
0 Kudos

you can use this simple code....

data:

imp_dt1 type EEIND,

imp_dt2 type EEIND,

imp_dt3 type EEIND,

l_date1 type sydatum,

l_date2 type sydatum,

l_date3 type sydatum.

write sy-datum to imp_dt1.

write sy-datum to imp_dt2.

write sy-datum to imp_dt3.

CALL FUNCTION 'DATE_IN_FUTURE'

EXPORTING

anzahl_tage = 29

import_datum = imp_dt1

IMPORTING

EXPORT_DATUM_INT_FORMAT = l_date1

.

CALL FUNCTION 'DATE_IN_FUTURE'

EXPORTING

anzahl_tage = 58

import_datum = imp_dt1

IMPORTING

EXPORT_DATUM_INT_FORMAT = l_date2

.

CALL FUNCTION 'DATE_IN_FUTURE'

EXPORTING

anzahl_tage = 80

import_datum = imp_dt1

IMPORTING

EXPORT_DATUM_INT_FORMAT = l_date3

.

write: l_date14(2) , l_date24(2) , l_date3+4(2).

now you can specify month according to that...

like if 01 then January 02 Feb....

You may find any other way but this is the simplest one.....

reward points if it helps...