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

Issue with date conversion

Former Member
0 Likes
993

Hello,

I am getting input string as YYYYMMD. I want it to be converted to date format based on the format that user has in his profile.

So if user has MM/DD/YYY or DD.MM.YYYY or any other ata from user data paramets, I want to convert it into that format.

I tried using FM Convert_date_to_external but it has issue since when I test it does not take data in YYYYMMDD format.

Please hlep.

Regards,

rajesh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
947

you can simple use write to convert to the format in the user profile.

parameters : p_date TYPE mkpf-budat. 
data : v_date(10) TYPE C. 

Write p_date TO v_date.

7 REPLIES 7
Read only

Former Member
0 Likes
948

you can simple use write to convert to the format in the user profile.

parameters : p_date TYPE mkpf-budat. 
data : v_date(10) TYPE C. 

Write p_date TO v_date.

Read only

0 Likes
947

Sorry ignore.

Edited by: Amit Gujargoud on Nov 5, 2008 6:31 PM

Read only

Former Member
0 Likes
947

Actually, it would be the other one.

CONVERT_DATE_TO_INTERNAL

Read only

Former Member
0 Likes
947

I guess you are trying in SE37 test. it wouldnt work there, you can try that in yoru code

Read only

Former Member
Read only

Former Member
0 Likes
947

Use FM DATUMSAUFBEREITUNG

I used like this and it worked for me:

data: idate TYPE sy-datum,
          tdat8 type string.
idate              = p_budat.
CALL FUNCTION 'DATUMSAUFBEREITUNG'
     EXPORTING
       IDATE                 = idate
     IMPORTING
        TDAT8                 = tdat8" get user format date here
*     EXCEPTIONS
*       DATFM_UNGUELTIG       = 1
*       DATUM_UNGUELTIG       = 2
*       OTHERS                = 3.

Read only

Former Member
0 Likes
947

Hi Rajesh,

1. Define a variable with type 'DATS'.

2. Move input date string 'YYYYMMDD' to this.

3. Write this date variable to Output string.

DATA : v_date type dats, 
           output_date_string(10) type c . 

v_date = input_date_string . 

write v_date to output_date_string .

And output_date_string will contain the date in user defined date format.

Thanks,

Aditya. V