SAP ABAP Function Module to Get Month Names
To get the month names you can use the following function module.
MONTH_NAMES_GET
Please find the program below.
REPORT ZEX_GETMONTHS .
data: d_return like sy-subrc,
itab_T247 like T247 occurs 0 with header line.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
IMPORTING
RETURN_CODE = d_return
TABLES
MONTH_NAMES = itab_T247
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_t247.
Write:/ itab_t247-LTX.
endloop.
The output of the above program is given below.
Get the names of Months
January
February
March
April
May
June
July
August
September
October
November
December
Please not that you can use the table T247 to get all the Months names. The above function module is an RFC and can be called from another SAP or NON SAP system.
No comments:
Post a Comment