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

Increment a Char Variable

Former Member
0 Likes
663

How do you increment a character variable?

Eg.

DATA: L_VAR1(3) TYPE C,

L_INC(3) TYPE C.

L_VAR1 = '080'

L_INC = '001'.

Then I need in a particular Loop run, L_VAR1 to vary from 080, 081, 082...120.

If I increment it with L_VAR1 = L_VAR1 + L_INC.

The next value stored is 81 and not 081.

Please provide Inputs in2 this.

Thanks

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
0 Likes
423

Hi..

Since u need a numeric value. Declare with Type N.

Eg:

DATA: L_VAR1(3) TYPE N,

L_INC(3) TYPE N.

L_VAR1 = '080'

L_INC = '001'.

Then:

L_VAR1 = L_VAR1 + L_INC. "This will work.

<b>

REWARD IF HELPFUL.</b>

2 REPLIES 2
Read only

varma_narayana
Active Contributor
0 Likes
424

Hi..

Since u need a numeric value. Declare with Type N.

Eg:

DATA: L_VAR1(3) TYPE N,

L_INC(3) TYPE N.

L_VAR1 = '080'

L_INC = '001'.

Then:

L_VAR1 = L_VAR1 + L_INC. "This will work.

<b>

REWARD IF HELPFUL.</b>

Read only

Former Member
0 Likes
423

Hi Anand,

Declare anothere integer variable and pass final char value to that and try you will get the desired output.

Satish