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

Write Statement Formatting

Former Member
0 Likes
616

Hi,

I have a value in an integer variable. I want to display the value in the output with 2 characters.

For example,

if the value is 2, i want to display it as 02,

if the value is 9, i want to display it as 09,

if the value is 12, i want to display it as 12,

How do i achieve this?.

Thanks,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
568

Hi Sandeep,

try declaring the Data type 'N' or type 'C'.

Regards

Allan Cristian

3 REPLIES 3
Read only

Former Member
0 Likes
569

Hi Sandeep,

try declaring the Data type 'N' or type 'C'.

Regards

Allan Cristian

Read only

Former Member
0 Likes
568

declare like this.

data : num(2) type n.

Read only

Former Member
0 Likes
568

Try:

DATA: f1     TYPE i,
      f2(2) TYPE n.

f1 = 2.
f2 = f1.
WRITE: /001 f2.

f1 = 9.
f2 = f1.
WRITE: /001 f2.

f1 = 12.
f2 = f1.
WRITE: /001 f2.

Rob