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

Decimal Conversion! Urgent

Former Member
0 Likes
646

Hello,

I need to read a file *.txt that have a field with the value '1230'.

In my program i need to convert these field to a similar one like '12.30'

Is there a easy way to do that or do i need to use concatenate?

Thanks in advance.

Best regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
621
data : cdat(10) type c value '1230',
        final type p decimals 2.

         final = cdat / 100.


       write:/ final.

check this.

do the operation in ur itab with the same ,

hope this helps ..

regards,

vijay

Message was edited by:

Vijay

5 REPLIES 5
Read only

Former Member
0 Likes
621
divide that number by 100

v_num = 1230 / 100.

Not sure if this is ur requirement
Read only

Former Member
0 Likes
621

Hi,

I don't think concatenate will serve your purpose.

Try using SHIFT operator & write each digit into another field by inserting a decimal point at desired place.

or divide by 100 & concatenate the quotient with the remainder with a decimal point.

null

Read only

Former Member
0 Likes
621

Hi,

1) Upload the .txt file into an internal table.

2) Read table i_tab with Key field = '1230'.

3) Pass this value in a variable ws_var = i_tab-field

4) Divide the number by 100. <b>ws_var1 = ws_var/100.</b>

You can use SEARCH statement also.. Do F1 on SEARCH in Se38 and learn more.

Hope this helps.

Manish

Read only

Former Member
0 Likes
622
data : cdat(10) type c value '1230',
        final type p decimals 2.

         final = cdat / 100.


       write:/ final.

check this.

do the operation in ur itab with the same ,

hope this helps ..

regards,

vijay

Message was edited by:

Vijay

Read only

Former Member
0 Likes
621

Thanks a lot!