Application Development and Automation 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: 
Read only

Date format

Former Member
0 Likes
1,117

Hi Experts,

Let me know is there any function module in sap abap to convert the given date format to DD-MMM-YYYY.

Example :  Input : 23.07.2013

                Output : 23-JUL-2013

regards.

1 ACCEPTED SOLUTION
Read only

former_member209120
Active Contributor
0 Likes
1,070

Hi Gururaj,

Solution

data: var_date(15),
         var_date_1(15).


     write sy-datum to var_date.
     Write : / 'Before:', var_date.



     var_date   = sy-datum.
     CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
       EXPORTING
         input         = var_date
       IMPORTING
         OUTPUT        = var_date_1.

     write var_date_1 to var_date using edit mask  '__-___-_____'.
     Write : / 'After :' , var_date.

6 REPLIES 6
Read only

FredericGirod
Active Contributor
0 Likes
1,070

Hi,

you could try to use the MONTH_NAMES_GET function

regards

Fred

Read only

former_member585060
Active Contributor
0 Likes
1,070

Hi

Tri with WRITE statement with EDIT MASK.

Just click F1 on WRITE statement, you will get the documentation.

Thanks & Regards

Bala Krishna

Read only

satyabrata_sahoo3
Contributor
0 Likes
1,070

If you have dates in this format ' YYYYMMDD' you can convert to DD(Month)YYYY using FM:

CONVERSION_EXIT_IDATE_OUTPUT. You can then modify this as per desired format.

Read only

former_member209120
Active Contributor
0 Likes
1,071

Hi Gururaj,

Solution

data: var_date(15),
         var_date_1(15).


     write sy-datum to var_date.
     Write : / 'Before:', var_date.



     var_date   = sy-datum.
     CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
       EXPORTING
         input         = var_date
       IMPORTING
         OUTPUT        = var_date_1.

     write var_date_1 to var_date using edit mask  '__-___-_____'.
     Write : / 'After :' , var_date.

Read only

Former Member
0 Likes
1,070

Hi,

I am not sure about the standard function module for your requirement

Try this coding it will use to solve your need.

parameters: date like sy-datum.

data: begin of itab occurs 0,

SPRAS type SPRAS,

MNR LIKE T247-MNR,

KTX LIKE T247-KTX,

LTX LIKE T247-LTX,

end of itab.

DATA : month LIKE T247-MNR.

DATA: YEAR(4).

DATA: FINAL(10).

DATA: DAY(2).

DAY = DATE+6(2).

MONTH = DATE+4(2).

YEAR = DATE+0(4).

select SINGLE * from t247 into itab where mnr = month

AND SPRAS = 'E'.

APPEND ITAB.

CONCATENATE DAY Month YEAR INTO FINAL SEPARATED BY '-'.

WRITE: FINAL.

Read only

Former Member
0 Likes
1,070

Hi Gururaj,

Try This FM's CONVERSION_EXIT_SDATE_OUTPUT/CONVERSION_EXIT_IDATE_OUTPUT


Go through the below links briefly explained how to convert the date formats.

http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP+-+Function+module+for+converting+any+External+dat...

http://wiki.sdn.sap.com/wiki/display/Snippets/FUNCTION+MODULE+FOR+CONVERTING+DATE+INTO+THE+GIVEN+FORMAT


Regard's,

Shashi Kanth.