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: 

How to convert date as '11.09.2007' to sy-datum format.

Former Member
0 Kudos

Hi Abappers,

How can i convert Date specified as '11.09.2007 ' with data type char (10) into sy-datum format.

Regards.

Mansi.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

use EDIT MASK.

9 REPLIES 9

Former Member

try this


data : cdate(10) value '11.09.2007',
       ddate like sy-datum.

CALL FUNCTION 'CONVERSION_EXIT_IDATE_INPUT'
  EXPORTING
    INPUT         = cdate
 IMPORTING
   OUTPUT        = ddate
          .

       write : / ddate.

regards

shiba dutta

Former Member
0 Kudos

Hi mansi

data c_date(10) type c.

data v_date like sy-datum.

c_date = '11.09.2007'.

wirte c_date0(2) to v_date6(2).

wirte c_date3(2) to v_date4(2).

wirte c_date6(4) to v_date0(4).

write : / v_date.

Regards

Wiboon

Former Member
0 Kudos

Hi,

use EDIT MASK.

Former Member
0 Kudos

Hi,

try like below

concatenate chardate+6(4)

chardate+3(2)

chardate+0(2)

into date.

Regards

Shiva

Former Member
0 Kudos

Hi,

You can try with this FM:PERIOD_AND_DATE_CONVERT_INPUT .

Hope it works.

Thanks,

Sandeep.

Former Member
0 Kudos

Hi Mansi,

If your date format in character type is same as user format then use function module CONVERSION_EXIT_IDATE_INPUT to get the character date into internal date format,othewise, check this code.

DATA VC_DATE(10) TYPE '11.09.2007',

V_DATE TYPE SY-DATUM.

CONCATENATE VC_DATE6(4) VC_DATE3(2) VC_DATE+0(2) INTO V_DATE.

WRITE:/ V_DATE.

Thanks,

Vinay

Former Member
0 Kudos

could not be done

0 Kudos

Hi,

try this code :

data : date(10),

text1(26),

num1(10),

test_day(15),

o_date(20),

idate(10).

data : Day(2), month(2), Year(4).

data : ODay(2), Omonth(2), OYear(4).

date = '11.09.2007'.

day = date+0(2).

month = date+3(2).

year = date+6(4).

concatenate year month day into idate.

write : 'your date', date.

write : 'sy-datum format (yyyymmdd)', idate.

I hope, it can help you,

Reward points, if helpful,

Sandeep Kaushik

0 Kudos

Hi,

Try the following. it will resolve the problem. You can check the date in internal format by debugging after writing the BREAK-POINT after the functio module but on the screen it will display as '.' or '/'. separated.


DATA: v_date(10)      TYPE c VALUE '11.09.2007',
      v_int_date(10) TYPE c.

v_int_date+8(2) = v_date+0(2).
v_int_date+4(4) = v_date+2(4).
v_int_date+0(4) = v_date+6(4).

CALL FUNCTION 'CONVERSION_EXIT_PDATE_INPUT'
  EXPORTING
    input  = v_int_date
  IMPORTING
    output = v_int_date.

WRITE:/ v_date.

Reard points if helpful answer.

Ashvender