System Date Format to DD-MON-YYYY

What is the FM to convert system date format to DD-MON-YYYY ?
Format or DD.MON.YYYY format. Eg. 27-SEP-2006 or 27.SEP.2006.

You can use this FM :

DATE_CONVERT_TO_FACTORYDATE

or

Instead of function modules, you can follow this code :

  Types : begin of gty_vbrp,
  vbeln type vbrp-vbeln,
  abrbg type vbrp- abrbg,
  End of gty_vbrp.
  Data : gi_vbrp type standard table of gty_vbrp,
  gwa_vbrp type gty_vbrp.
  CONSTANTS: c_jan(3) TYPE c VALUE 'JAN',
  c_feb(3) TYPE c VALUE 'FEB',
  c_mar(3) TYPE c VALUE 'MAR',
  c_apr(3) TYPE c VALUE 'APR',
  c_may(3) TYPE c VALUE 'MAY',
  c_jun(3) TYPE c VALUE 'JUN',
  c_jul(3) TYPE c VALUE 'JUL',
  c_aug(3) TYPE c VALUE 'AUG',
  c_sep(3) TYPE c VALUE 'SEP',
  c_oct(3) TYPE c VALUE 'OCT',
  c_nov(3) TYPE c VALUE 'NOV',
  c_dec(3) TYPE c VALUE 'DEC',
  c_01(2) TYPE c VALUE '01',
  c_02(2) TYPE c VALUE '02',
  c_03(2) TYPE c VALUE '03',
  c_04(2) TYPE c VALUE '04',
  c_05(2) TYPE c VALUE '05',
  c_06(2) TYPE c VALUE '06',
  c_07(2) TYPE c VALUE '07',
  c_08(2) TYPE c VALUE '08',
  c_09(2) TYPE c VALUE '09',
  c_10(2) TYPE c VALUE '10',
  c_11(2) TYPE c VALUE '11',
  c_12(2) TYPE c VALUE '12'.

  DATA:
  lv_dd1(2) TYPE n,
  lv_dd2(3) TYPE c,
  lv_dd3(2) TYPE c,
  lv_dd4(2) TYPE c,
  lv_ddate(9) TYPE c.

This code is with in the loop. Now I am splitting the date from work area to local variables:

  loop at gi_item into gwa_item.
  MOVE: gwa_item_fv-abrbg+2(2) TO lv_dd1,
  gwa_item_fv-abrbg+4(2) TO lv_dd4,
  gwa_item_fv-abrbg+6(2) TO lv_dd3.
  CASE: lv_dd4.
  WHEN c_01.
  MOVE c_jan TO lv_dd2.
  WHEN c_02.
  MOVE c_feb TO lv_dd2.
  WHEN c_03.
  MOVE c_mar TO lv_dd2.
  WHEN c_04.
  MOVE c_apr TO lv_dd2.
  WHEN c_05.
  MOVE c_may TO lv_dd2.
  WHEN c_06.
  MOVE c_jun TO lv_dd2.
  WHEN c_07.
  MOVE c_jul TO lv_dd2.
  WHEN c_08.
  MOVE c_aug TO lv_dd2.
  WHEN c_09.
  MOVE c_sep TO lv_dd2.
  WHEN c_10.
  MOVE c_oct TO lv_dd2.
  WHEN c_11.
  MOVE c_nov TO lv_dd2.
  WHEN c_12.
  MOVE c_dec TO lv_dd2.
  ENDCASE.
  ………………
  endloop.

Tips by : Govardhan

Related:

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

Back to ABAP Menu:
ABAP Example Hints and Tips

Return to :-
SAP Hints and Tips on Configuration and ABAP/4 Programming

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.