Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

date conversion logic using function modules

Hi there,

I have been researching in the forum how data conversion is done in ABAP and I found out about the function modules

CONVERSION_EXIT_LDATE_OUTPUT

and

MONTH_NAMES_GET

It seems that the first function module can convert the date format 06/08/2011 to MONTH DD,YYYY and the second function can easily translate the month names once language SPRAS has been specified.

Problem is I am not sure how I can convert my VBRK-FKDAT with format MM/DD/YYYY into the format DD MONTH YYYY format with the MONTH still dependent on the specified language.

I tried to look at how to MONTH_NAMES_GET FM works and made this code:

DATA: d_return like sy-subrc,
      itab_T247 like T247 occurs 0 with header line,
      gs_spras type spras.

gs_spras = 'RU'.

CALL FUNCTION 'MONTH_NAMES_GET'
 EXPORTING
   LANGUAGE                    = gs_spras
 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 code just lists the months in Russian (which is the language I need). I am just new to ABAP so I am an avid reader of the forum. I hope someone can help.

Thanks,

dgrachee

Former Member
Not what you were looking for? View more on this topic or Ask a question