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

convert to

Former Member
0 Likes
1,931

Hello Gurus!

The problem what I am having is:

this works fine


data tmstmp type TZNTSTMPS.
data currDate(10) type c value '14.02.2007'.
data w_date type sy-datum.

concatenate currDate+6(4) currDate+3(2) currDate+0(2)
into w_date.

CALL FUNCTION 'ABI_TIMESTAMP_CONVERT_INTO'
EXPORTING
iv_date = w_date
iv_time = '000000'    "'00:00:00'
IMPORTING
EV_TIMESTAMP = tmstmp .
write tmstmp.

but this not because date has another format


data tmstmp type TZNTSTMPS.
data currDate(10) type c value '02/14/2007'.
data w_date type sy-datum.

concatenate currDate+6(4) currDate+3(2) currDate+0(2)
into w_date.

CALL FUNCTION 'ABI_TIMESTAMP_CONVERT_INTO'
EXPORTING
iv_date = w_date
iv_time = '000000'    "'00:00:00'
IMPORTING
EV_TIMESTAMP = tmstmp .
write tmstmp.

Regards

Sas

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,005

Hi ,

In the First case it works because w_date is 20070214 .

In the second case w_date comes as 20071402

Format is YYYYMMDD.

In the second case you have to change the following statement

concatenate currDate6(4) currDate3(2) currDate+0(2)

into w_date

to

concatenate currDate6(4) currDate0(2) currDate+3(2)

into w_date

Please reward if useful.

5 REPLIES 5
Read only

Former Member
0 Likes
1,005

Convert the date to the same format and give that to that function module


concatenate v_date+3(2) v_date+0(2) v_date+6(4) into
v_date1 separated by '.' 
else

  DATA: val(10).
  WRITE sy-datum TO val DD/MM/YYYY.
  TRANSLATE val USING '/.'.
  WRITE val.

Read only

Former Member
0 Likes
1,005

Hi,

Change the date format in user profile defaults.

Pranav

Read only

0 Likes
1,005

Hi,

Sorry. Santhose is correct. You have to give the same format as that function module.

Pranav

Read only

Former Member
0 Likes
1,006

Hi ,

In the First case it works because w_date is 20070214 .

In the second case w_date comes as 20071402

Format is YYYYMMDD.

In the second case you have to change the following statement

concatenate currDate6(4) currDate3(2) currDate+0(2)

into w_date

to

concatenate currDate6(4) currDate0(2) currDate+3(2)

into w_date

Please reward if useful.

Read only

Former Member
0 Likes
1,005

Hi,

data tmstmp type TZNTSTMPS.
data currDate(10) type c value '14.02.2007'.
data w_date type sy-datum.
 
concatenate currDate+0(4) '.' currDate+4(2) '.' currDate+6(2)
into w_date.

Regards,

V.Balaji

Reward if usefull