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

Alignment

Former Member
0 Likes
768

Hi everyone,

I have to align data based on decimal point.

eg :- right now my values are coming as follows

99.01

7.19

100.00.

I want all dots on the same column.

how i will do that?

6 REPLIES 6
Read only

Former Member
0 Likes
723

REPORT Z3TEST .

data : P1 type p decimals 2 value '99.01',

P2 type p decimals 2 value '7.19',

P3 type p decimals 2 value '100.00'.

write : / P1,

/ P2,

/ P3.

Its looking fine.

Read only

dani_mn
Active Contributor
0 Likes
723

Hi Use RIGHT-JUSTIFIED Addition with write.

WRTIE: value RIGHT-JUSTIFIED .

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
723

Use 'right-justified' with your 'write' command. Your problem would be resolved.

Regards,

Subhasish

Read only

Former Member
0 Likes
723

Hi,

Change the data type to quan or curr. It will automatically align the figures according to decimal point.

Regards,

Shashank

Read only

0 Likes
723

Hi,

if your data type is P then it'll print fine.

data : begin of i_tab occurs 0,

val(10) type p decimals 2,

end of i_tab.

i_tab-val = '10.99'.

append i_tab.

i_tab-val = '1.99'.

append i_tab.

i_tab-val = '100.99'.

append i_tab.

loop at i_tab.

write : / i_tab-val.

endloop.

else if your data type is C use right-justified.

data : begin of i_tab occurs 0,

val(10) ,

end of i_tab.

i_tab-val = '10.99'.

append i_tab.

i_tab-val = '1.99'.

append i_tab.

i_tab-val = '100.99'.

append i_tab.

loop at i_tab.

write : / i_tab-val right-justified.

endloop.

Regards,

sumit.

Read only

Former Member
0 Likes
723

Hi Shefali,

Try this it works for me.

DATA: ws_value1 TYPE p DECIMALS 2,

ws_value2 TYPE p DECIMALS 2.

ws_value1 = 200 + ( 200 / 1000 ).

ws_value2 = 10 + ( 200 / 1000 ).

WRITE: / ws_value1,

/ ws_value2.

<b> o/p:</b>

200.20

10.20

Reward if helpful.

Regards,

Tushar