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

Converting string to decimal

Former Member
0 Likes
3,604

Hi,

I have a string like say, "28.08.2012 21:30:00". I need the entire string to be converted into a decimal value as it is. How do I proceed with this? I'm new to ABAP.

Regards,

Ninaada

5 REPLIES 5
Read only

JoffyJohn
Active Contributor
0 Likes
1,588

Try replacing the specialn character using REPLACE statement and then move the content to a

decimal variable.

Read only

Former Member
0 Likes
1,588

Got it to work. Just moved the string to decimal values.

Read only

Former Member
0 Likes
1,588

Call the Function Module : WSAF_CONV_STRING_TO_DECIMAL

Read only

Former Member
0 Likes
1,588

Hi,

Try this.

DATA: p1 TYPE string VALUE '28.08.2012 21:30:00'.

DATA: p2 typeDECIMALS 1 .

REPLACE ALL OCCURRENCES OF '.' in p1 WITH SPACE.

REPLACE ALL OCCURRENCES OF ':' in p1 WITH SPACE.

CONDENSE P1 NO-GAPS.
P2 = P1.

WRITE P2.

Regards,

Riyas.

Read only

ThomasZloch
Active Contributor
0 Likes
1,588

very basic -> un-marked as question.