Application Development 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: 

date fomat

Former Member
0 Kudos

Hi all,

I need the output of date in format..

October 25,2006.

is there any function module to get the output in this format?

Regards,

ajith

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

just give 10252006 as the input in the parameter and execute the code .

*----


REPORT ZEX6 .

PARAMETERS: V_DATUM(11) TYPE C.

DATA: V_MON(3) TYPE C,

V_DAT(2) TYPE C,

V_YEAR(4) TYPE C,

V_MONTHNAME(10) TYPE C,

V_FULLDATE(30) TYPE C.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

date_external = V_DATUM

IMPORTING

DATE_INTERNAL = V_DATUM

EXCEPTIONS

DATE_EXTERNAL_IS_INVALID = 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.

WRITE V_DATUM+4(2) TO V_MON.

WRITE V_DATUM+6(2) TO V_DAT.

WRITE V_DATUM+0(4) TO V_YEAR.

SELECT SINGLE LTX FROM T247 INTO V_MONTHNAME

WHERE SPRAS = SY-LANGU

AND MNR = V_MON.

CONCATENATE V_MONTHNAME

V_DAT ',' v_YEAR

INTO V_FULLDATE SEPARATED BY SPACE.

WRITE:/ V_FULLDATE.

regards,

Vijay.

Kindly close the thread if ur query is over .

8 REPLIES 8

Former Member
0 Kudos

Hi ajith,

1. U can make use of the fm

CONVERSION_EXIT_SDATE_OUTPUT

25-Oct-2006

regards,

amit m.

Simha_
Employee
Employee
0 Kudos

Hi,

Use the FUnction Module..

<b>CONVERSION_EXIT_SDATE_OUTPUT</b>

U will able to get the date in ur format..

25-Oct-2006.

Cheers,

Simha.

Former Member
0 Kudos

Hi,

I need the output in the format

October 25,2006.

But using the FM

CONVERSION_EXIT_SDATE_OUTPUT

the output is OCT/25/2006

Regards,

Ajith

0 Kudos

Hi again,

1. 20061025

---> October 25, 2006.

2. For this purpose, there in an independent subroutine in my program.

3. just copy paste.

REPORT abc.

DATA : mname(20) TYPE c.

PARAMETER : d TYPE sy-datum default Sy-datum.

PERFORM getmonth USING d mname.

WRITE 😕 mname.

&----


*& Form getmonth

&----


  • text

----


  • -->M text

  • -->MNAME text

----


FORM getmonth USING d mname.

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.

CONCATENATE MNAME D+6(2) ',' D(4) INTO MNAME SEPARATED BY SPACE.

ENDFORM. "getmonth

regards,

amit m.

0 Kudos

Try the below logic.

ldate ==> input date.

SELECT ltx into lcmon from T247

where spras = sy-langu and

mnr = ldate+4(2).

Concatenate lcmon ldate+6(2) ',' ldate(4) into ltext

separated by space.

Regards

Anurag

Former Member
0 Kudos

Hi,

CONVERSION_EXIT_SDATE_OUTPUT

u can use this fm to get the date as oct/25/2006

split the date as 0ct,

25,

2006

now u need to write a logic as

case when 'JAN'

move 'January' to var.

;;;

;;

when 'OCT' to

move october to var.

endcase.

concatenate var(month text) date ',' year into v_val.

now write v_val . october 25 , 2006

u need to go this way ..

hope this helps ,

Regards,

Vijay

Former Member
0 Kudos

Hi,

just give 10252006 as the input in the parameter and execute the code .

*----


REPORT ZEX6 .

PARAMETERS: V_DATUM(11) TYPE C.

DATA: V_MON(3) TYPE C,

V_DAT(2) TYPE C,

V_YEAR(4) TYPE C,

V_MONTHNAME(10) TYPE C,

V_FULLDATE(30) TYPE C.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

date_external = V_DATUM

IMPORTING

DATE_INTERNAL = V_DATUM

EXCEPTIONS

DATE_EXTERNAL_IS_INVALID = 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.

WRITE V_DATUM+4(2) TO V_MON.

WRITE V_DATUM+6(2) TO V_DAT.

WRITE V_DATUM+0(4) TO V_YEAR.

SELECT SINGLE LTX FROM T247 INTO V_MONTHNAME

WHERE SPRAS = SY-LANGU

AND MNR = V_MON.

CONCATENATE V_MONTHNAME

V_DAT ',' v_YEAR

INTO V_FULLDATE SEPARATED BY SPACE.

WRITE:/ V_FULLDATE.

regards,

Vijay.

Kindly close the thread if ur query is over .

Former Member
0 Kudos

Hi,

You can use the FM

CONVERSION_EXIT_SDATE_OUTPUT

the output is OCT/25/2006.

Then using this you can form October 25,2006. By doing the manipulation in the ABAP Code.

Regards,

Govindarajan Umadevi.