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

PLEASE ADVISE: Formatting decimal data

Former Member
0 Likes
508

I have a report that needs to display the DEC16_3 value

19837000.000

Like this

19,837,000.00

I thought the following would work:

write gt_cpr_report-covered_volume          to gv_str_covered_volume          right-justified decimals 2.

But, instead, it write it like this:

19837,000.00

I've NO idea why it displayed like that. What's the easiest way to display a value with thousands separator with two digits?

THANKS IN ADVANCE!

<LOCKED BY MODERATOR - URGENT, PLEASE HELP OR SIMILAR ARE FORBIDDEN>

Edited by: Alvaro Tejada Galindo on Aug 25, 2008 5:08 PM

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
478

Try like this:


data: p_dec3 type DEC16_3,
      p_dec2 type p decimals 2.

p_dec3 = '12345678.900'.
write:  p_dec3.

p_dec2 = p_dec3.
write: / p_dec2.

Regards,

Naimesh Patel

I have a report that needs to display the DEC16_3 value

19837000.000

Like this

19,837,000.00

I thought the following would work:

write gt_cpr_report-covered_volume          to gv_str_covered_volume          right-justified decimals 2.

But, instead, it write it like this:

19837,000.00

I've NO idea why it displayed like that. What's the easiest way to display a value with thousands separator with two digits?

THANKS IN ADVANCE!

<LOCKED BY MODERATOR - URGENT, PLEASE HELP OR SIMILAR ARE FORBIDDEN>

Edited by: Alvaro Tejada Galindo on Aug 25, 2008 5:08 PM

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
479

Try like this:


data: p_dec3 type DEC16_3,
      p_dec2 type p decimals 2.

p_dec3 = '12345678.900'.
write:  p_dec3.

p_dec2 = p_dec3.
write: / p_dec2.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
478

Steve,

I think your problem is the result of your output field not being large enough to hold the results of the write statement. The following code ...


DATA: input(9) TYPE p DECIMALS 3 VALUE '19837000.000',
      output1(13) TYPE c,
      output2(20)  TYPE c.
WRITE input  TO output1
  left-JUSTIFIED DECIMALS 2.
write: / output1.
WRITE input  TO output2
  left-JUSTIFIED DECIMALS 2.
write: / output2.

... results in output as follows:

19837,000.00

19,837,000.00

I hope this helps ...

Duane