Application Development 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: 

Making a value of a charcter follow decimal notation det by user

Former Member
0 Kudos

Hi guys,

Is possible for a character value to follow the decimal notation set by user?

ex... if v_char = 11234.50

I want my output to be 11,234.50 as per my decima notation set up...

thanks!

1 ACCEPTED SOLUTION

vinod_vemuru2
Active Contributor
0 Kudos

Hi Mark,

i hope u have this value 11234.50 in some currency/quantity data type field. If yes then do like like this.

WRITE curr/quantity field TO v_char.

It writes data as per user settings.

WRITE v_char .

Sample code.


DATA: char(20) TYPE c,
      quan TYPE LIPS-lgmng VALUE '123456.25'.
WRITE  quan TO char.
CONDENSE char.
WRITE: char.

If it is hard coded value then first pass it to some currency/quantity field then use WRITE TO statement for converting data as per user settings.

Make sure that ur char field have sufficient length(Including seperators).

Thanks,

Vinod.

Edited by: Vinod Reddy Vemuru on Jul 31, 2008 12:35 PM

4 REPLIES 4

Former Member
0 Kudos

Hi Mark,

as per my understandin you need to covert character field value to currency or quantity is it?

for this u need to convert v_char without decimal

by using statement

replace all the occurences of '.' in v_char with ' '.

condense v_char.

then u can write this value to currency or quantity field.

write v_char to v_field.

Reward if useful.

Cheers,

Balaji

Former Member
0 Kudos

I think first u can store the value to a type P variable and then move it to a char variable.

v_packed = 11234.50.

write v_packed to v_char.

Now in v_char u will get 11,234.50.

Regards,

Joy.

vinod_vemuru2
Active Contributor
0 Kudos

Hi Mark,

i hope u have this value 11234.50 in some currency/quantity data type field. If yes then do like like this.

WRITE curr/quantity field TO v_char.

It writes data as per user settings.

WRITE v_char .

Sample code.


DATA: char(20) TYPE c,
      quan TYPE LIPS-lgmng VALUE '123456.25'.
WRITE  quan TO char.
CONDENSE char.
WRITE: char.

If it is hard coded value then first pass it to some currency/quantity field then use WRITE TO statement for converting data as per user settings.

Make sure that ur char field have sufficient length(Including seperators).

Thanks,

Vinod.

Edited by: Vinod Reddy Vemuru on Jul 31, 2008 12:35 PM

Former Member
0 Kudos

Hi Mark,

It is not possible to display the CHAR variable v_char = 11234.50 as 11,234.50 .

The output will be 11234.50 itself.

If you want to display v_char = 11234.50 as 11,234.50 you need to pass this value to a variable which is of CURRENCY type

For Example:

DATA: v_char(10) TYPE c VALUE '11234.50',
      v_curr TYPE netwr.     " Currency Field

v_curr = v_char.

WRITE: v_curr.

Best regards,

raam