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

remove '.' from date

Former Member
0 Likes
3,917

hi,

i am passing a date field in my program as 23.09.2008, but i want to remove the '.' before process it. can any one advice what is the code to remove '.'? i believe there is but i already forgotten of it. thanks

7 REPLIES 7
Read only

Former Member
0 Likes
2,300

hi...

use replace

regards

vivek

Read only

rainer_hbenthal
Active Contributor
0 Likes
2,300

REPLACE all occurences of '.' in date_field with ''.
Read only

Former Member
0 Likes
2,300

DATA: w_var(10) TYPE c.
w_var = '31.12.2008'.

REPLACE ALL OCCURRENCES OF '.' in w_var WITH '' .
WRITE / w_var.
Read only

Former Member
0 Likes
2,300

Hi ben,

Replace will only remove .(dots) and give the date as 23092008 but the internal date format is 20080923.

So use the FM CONVERT_DATE_TO_INTERNAL to convert a date to internal format.

Revert Back if you have doubts.

Regards

Karthik d

Read only

bpawanchand
Active Contributor
0 Likes
2,300

hi

DATA :
   w_d TYPE d,
   w_d1 TYPE sy-datum.


w_d1 = sy-datum.

CONCATENATE w_d1+0(4) w_d1+4(2) w_d1+6(2) INTO w_d.

WRITE :
  / w_d.

Regards

Pavan

Read only

Former Member
0 Likes
2,300

Hi,

Try like this:

data: fld1(12) type c,

fld2(12) type c,

fld3(2) type c,

fld4(2) type c,

fld5(4) type c.

fld1 = '23.09.2008'.

fld3 = fld1+0(2).

fld4 = fld1+3(2).

fld5 = fld1+6(4).

concatenate fld3 fld4 fld5 into fld2.

write: / fld1,

/ fld2.

Regards,

Bhaskar

Read only

Former Member
0 Likes
2,300
believe there is but i already forgotten of it

But SDN database is still Active and Up so you need to just search nothing else