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

HOW TO SPLIT A NUMBER

Former Member
0 Likes
903

hi,

i have one value 35768. iwant to split into 35 and 768 how to achieve this??

please help me

Moderator message - Please do not ask or answer such basic questions - post locked

Edited by: Rob Burbank on Aug 14, 2009 9:28 AM

hi,

i have one value 35768. iwant to split into 35 and 768 how to achieve this??

please help me

Moderator message - Please do not ask or answer such basic questions - post locked

Edited by: Rob Burbank on Aug 14, 2009 9:28 AM

4 REPLIES 4
Read only

Former Member
0 Likes
871

Hi,

If it is stored in char variable or type n , u can do it.

data w_c(5) type c value '35678'.

w_c1 = w_c+0(2).

w_c2 = w_c+2(3).

Read only

0 Likes
871

data:num type i value '35678'.

data:begin of val,

c1(2) type c,

c2(3) type c,

end of val.

val = num.

Read only

Former Member
0 Likes
871

If it is a chaacter field I hope you already got the reply.

If it is int or type p variable

Just check this

DATA : lv_val1 TYPE i VALUE 35768,
       lv_result1 TYPE p,
       lv_result2 TYPE i.

lv_result1 =  FLOOR( lv_val1 / 1000 ).
lv_result2 = lv_val1 MOD 1000.

WRITE : / lv_result1.
WRITE : / lv_result2.

Regards

Shiba Prasad Dutta

Read only

0 Likes
871

thats it