Powered By

Free XML Skins for Blogger

Powered by Blogger

Saturday, October 18, 2008

SAP ABAP Program: Output of Date Format

Suppose a date is given in the format 20050428 how to get the output in the format 28th Apr 2005.

FORM set_text_date.

DATA: month(9),
year(4),
date(2).

CASE p_frd+4(2).

WHEN '01'.
month = 'January'.

WHEN '02'.
month = 'February'.

WHEN '03'.
month = 'March'.

WHEN '04'.
month = 'April'.

WHEN '05'.
month = 'May'.

WHEN '06'.
month = 'June'.

WHEN '07'.
month = 'July'.

WHEN '08'.
month = 'August'.

WHEN '09'.
month = 'September'.

WHEN '10'.
month = 'October'.

WHEN '11'.
month = 'November'.

WHEN '12'.
month = 'December'.

WHEN OTHERS.

ENDCASE.

WRITE p_frd+0(4) TO year.

WRITE p_frd+6(2) TO date.

CONCATENATE month date ',' year INTO return_date SEPARATED BY space.

CONDENSE return_date.

ENDFORM.

ABAP Tips by : Kiran

Currently my date is getting printed in format 05262005.
I want the output as 26 May, 2005.
I have tried using Set date mask option but it is not picking up in the output.

Code:

This code yields as 12 march 2006.

DATA: ZTEMP(9).

CLEAR: ZTEMP, ZDD, ZMMM, ZYYYY.

CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
INPUT = IS_DLV_DELNOTE-HD_GEN-CREA_DATE
IMPORTING
OUTPUT = ZTEMP.

ZDD = ZTEMP+3(2).
ZMMM = ZTEMP+0(3).
ZYYYY = ZTEMP+5(4).

No comments:

Archives