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

convertion

Former Member
0 Likes
716

i have a field in a table c_var as char15. the data of this is purely numeric. everytime i will save to the table i will need to increment this. how should i convert my variable in the program in order to fit to my requirements.

thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
698

Hi

I hope this will work for u.

data : w_val(10) type c value '0'.

do 10 times.

w_val = w_val + 1.

assign w_val to ur table field.

write 😕 w_val.

enddo.

thanks

Pavan

7 REPLIES 7
Read only

Former Member
0 Likes
698

In program use this variable.

DATA WA_VAR(15) TYPE N.

Read only

Lakshmant1
Active Contributor
0 Likes
698

Hi Donna,

Try changing variable as Numeric Character NUMC.

Thanks

Lakshman

Read only

Former Member
0 Likes
698

Hi

use a variable type N (numeric char) instead of C.

So you don't need any convertion and u can increment it.

DATA: COUNTER(15) TYPE N.

....

COUNTER = COUNTER + 1.

......

Max

Message was edited by: max bianchi

Read only

Former Member
0 Likes
698

data : l_val(10) type N.

n= 1

n= n + 1

assign this value to table field

cheers

sasi

Read only

Former Member
0 Likes
698

hi,

try this also

data : l_type type i,

l_char(15) type c.

l_type = 10.

l_char = l_type.

Read only

Former Member
0 Likes
699

Hi

I hope this will work for u.

data : w_val(10) type c value '0'.

do 10 times.

w_val = w_val + 1.

assign w_val to ur table field.

write 😕 w_val.

enddo.

thanks

Pavan

Read only

Former Member
0 Likes
698

Try:

REPORT ztest.
data counter type n.
select c_var from whatever
  into counter...
counter = counter + 1.
write counter to c_var.
.
.more processing
.
insert whatever...

Rob