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

regarding function module

Former Member
0 Likes
665

goodmrng experts,

cud u plz tell me about the function module in which if i pass month number i,e(1,2,,,,to 12) then it will display whether it is a january ,feburary etc...plz help me...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
646

DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.

DATA : m(2) TYPE c.

m = d+4(2).

CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE =

TABLES

month_names = month_names

EXCEPTIONS

month_names_not_found = 1

OTHERS = 2

.

READ TABLE month_names INDEX m.

IF sy-subrc = 0.

mname = month_names-ltx.

ENDIF.

5 REPLIES 5
Read only

Former Member
0 Likes
647

DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.

DATA : m(2) TYPE c.

m = d+4(2).

CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE =

TABLES

month_names = month_names

EXCEPTIONS

month_names_not_found = 1

OTHERS = 2

.

READ TABLE month_names INDEX m.

IF sy-subrc = 0.

mname = month_names-ltx.

ENDIF.

Read only

Former Member
0 Likes
646

Hi Ravi,

Use MONTH_NAMES_GET.

Regards,

Younus

Read only

anversha_s
Active Contributor
0 Likes
646

hi,

There are 2 ways.

<u><b>1.</b></u>

DATA: DATE_CHAR(20).
DATA: DATE TYPE SY-DATUM.
DATA: MONTH_NAME LIKE T247-LTX.
DATE = SY-DATUM.

SELECT SINGLE LTX FROM T247
INTO MONTH_NAME
WHERE SPRAS = SY-LANGU
AND MNR = SY-DATUM+4(2).

CONCATENATE SY-DATUM+6(2) MONTH_NAME SY-DATUM(4)
INTO DATE_CHAR SEPARATED BY SPACE.

WRITE: / DATE_CHAR.

<u><b>2. Use this Fm</b></u>

MONTH_NAMES_GET. "To get month description

.

Regards

Anversha

Read only

Former Member
0 Likes
646

Hi

Use the FM ISP_GET_MONTH_NAME

Import parameters Value

DATE

LANGUAGE

MONTH_NUMBER 01

Export parameters Value

LANGU_BACK EN

LONGTEXT January

SHORTTEXT JAN

Regards

Shiva

Read only

Former Member
0 Likes
646

Hai Ravi,

try this code.This one helps u to enter a value in screen and display the appropiate month.

parameter : month type i.

data : month_names like Table of T247 with header line.

CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE =

TABLES

MONTH_NAMES = month_names

  • 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 month_names.

if month_names-mnr = month.

write : month_names-ltx.

endif.

endloop.

Reward if helpful.